Last time i found in my project problem with circular dependencies. I resolve my problem but, i would like avoid this in future. I think about plugin which found circular dependencies in my all project and give me feedback.
Example:
File a.js:
var functionFromA= require("./b.js");
console.log("file a", functionFromA);
module.exports = {functionFromA: functionFromA};
File b.js:
var functionFromB = require("./c.js");
console.log("file b", functionFromB );
module.exports = {functionFromB : functionFromB };
File c.js:
var functionFromC = require("./a.js");
console.log("file c", functionFromC );
module.exports = {functionFromC : functionFromC }
When i run file a.js i see in console:
file c {}
file b { functionFromC: {} }
file a { functionFromB: { functionFromC: {} } }
I found "Circular Dependency Plugin" in npm but i don't know how use it? May be someone has similar problem and found a solution?
via new_user
No comments:
Post a Comment