Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

模块间相互依赖的问题 #1382

Closed
liujiangfeng opened this issue Nov 24, 2014 · 2 comments
Closed

模块间相互依赖的问题 #1382

liujiangfeng opened this issue Nov 24, 2014 · 2 comments

Comments

@liujiangfeng
Copy link

测试时偶尔发现的,3.0版本不存在这个问题,2.3版本中发现有这个问题。

描述:两个模块a.js、b.js ,如果a 、b间存在相互依赖,那么模块间的依赖加载会有问题。
再推广一下就是,如果模块间存在依赖环的话,模块间的依赖加载会有问题。

发现3.0中用Module.prototype.pass修复了该问题,

测试代码,现象就是在2.3中,a.doSomething()不会执行,3.0中会执行
seajs.use("a" , function(a){
a.doSomething();
});

a.js
define(function(require, exports , module) {
var b = require("b");
exports.doSomething = function() {
console.log("in a");
};
});

b.js
define(function(require, exports, module) {
var c = require("c");
exports.doSomething = function() {
console.log("in b");
};
});

c.js
define(function(require, exports, module) {
var a = require("a");
exports.doSomething = function() {
console.log("in c");
};
});

@army8735
Copy link
Member

3.0的循环依赖处理和node一样了,之前不支持。

@liujiangfeng
Copy link
Author

哈哈,还是要谢谢你们开发出这么棒的产品!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants