Closed ghost closed 9 years ago
I think we need this line
No, because leafDirective
is a persistent variable within the module, and exports will keep a reference to it.
Could you tell me which node version you are using? In fact, I've tried leafDirective
with node 5.1.0, and directives were not parsed properly.
As an experiment, I wrote this code: a.js
var b = require('./b');
console.log(b.foo);
b.f(444);
console.log(b.foo);
b.js
var foo = 123;
function f(arg) {
foo = arg;
console.log("f called");
};
module.exports = {
foo: foo,
f: f
};
Result:
$ node a.js
123
f called
123