Let's say I have module A.js and B.js.
A.js
var b = require('./B');
[...some code here...]
B.js
var a = require('./A');
[...some code here...]
than in my app.js
I have something like:
app.js
var a = require('./A');
[some code here]
The thing is that the var a
in B.js
is always an empty object {}
when I do like node app.js
while If I directly do node B.js
it is properly initialized.
What instead I would expect is that calling node app.js
it triggers A.js
(that requires B.js
) and so, in turn it initialtes its own a
variable.... but it is not like this apparently....