In my code, I need to call a sub-module, and in the sub-module I need to require a file that only has a relative path. So I need to join the 'current main' code path to the relative path.
I tried to use:
var conf = require(path.resolve(__dirname + ConfigPath));
But __dirname will get me the current sub-module path. What I need here is the main code path.
Can anyone please help here? many thanks!