__dirname variables for any path
const makeModuleEnv = ;const exports module require __filename __dirname =;// Use as normalrequire; // resolves to /Users/suchipi/Code/my-project/package.json if it exists
This module exports one function,
makeModuleEnv. It should be called with the absolute path to a file, and it will return an object with
__dirname properties that behave like the ones node would provide to that file. Note that the file at the path passed in does not need to exist, only the directories leading up to that file. So you can use eg.