Skip to content

Instantly share code, notes, and snippets.

@joshwnj
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshwnj/867c4123d87d3f3cb0c8 to your computer and use it in GitHub Desktop.
Save joshwnj/867c4123d87d3f3cb0c8 to your computer and use it in GitHub Desktop.
circular dependency
var b = require('./b')
console.log('B', b);
module.exports = {
doThingA: function () {
console.log('thing A');
b.doThingB();
}
}
var a = require('./a')
module.exports = {
doThingB: function () {
console.log('thing B');
}
}
var a = require('./a');
a.doThingA();
// output in both node and browserify is:
//
// thing A
// thing B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment