Instead of hard-coding a module name in commonModule
I'd set it so that I can give it a module object. For instance commonModule
could contain:
module.exports = function(other_module) {
return {
foo: function () {
return other_module.something("blah");
}
};
}
Then each project would then pass their own module to commonModule
:
var commonModule = require("commonModule")(require("./moduleX"));
commonModule.foo();
./moduleX
would be resolved according to each project, so no problem there. Your projects would have to be able to find commonModule
but it seems you've already have this part covered.