solving circular dependency in node using requirejs
问题 I have been try out many suggestions I found googling for circular dependency in node and requirejs. Unfortunately, I'm not getting it to work. The try which is closed to a solution (I think) is below: // run.js var requirejs = require('requirejs'); requirejs.config({ baseUrl: __dirname, nodeRequire: require }); requirejs(['A'], function(A) { var a = new A.Go(); console.log(a.toon()) }); // A.js define(['B', 'exports'], function(B, exports) { exports.Go = function() { var b = new require('B')