You can use global variables in native native, such as node, properties defined globally are accessible globally.
eg.
global.foo = "blah"; console.log(foo); //logs "blah"
Most node solutions in the above view should work correctly.
One that I used in the past is to define a global function at the top level of the directory, usually on the first line, for example
global.rootRequire = function(path) { return require(path); }
What just allows deep investment, it is required that he be from the root and avoid the whole business ../../ .
However, another comment is correct, if this is really a problem, perhaps something structurally does not fit the project.
deanmcpherson
source share