in a module containing two files in ./modx: modx.js and helper.js:
./modx/package.json:
{ "name" : "module x",
"main" : "./modx.js" }
./modx/helper.js:
function subFunc() { }
./modx/modx.js:
exports.mainFunc = function() {
var x = subFunc();
}
how do I make subFunc() in helper.js visible to modx.js when both are in the modx module?
The only object in script
Avisible from scriptBismodule.exports. Adding objects/functions tomodule.exports(just like you did it withmainFunc) makes them visible from the outside. There is no other way.