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

使用mod异步加载文件,失败后没有任何提示 #23

Open
fychinesepjj126 opened this issue Nov 17, 2015 · 0 comments
Open

使用mod异步加载文件,失败后没有任何提示 #23

fychinesepjj126 opened this issue Nov 17, 2015 · 0 comments

Comments

@fychinesepjj126
Copy link

使用modjs异步加载文件:
欲加载的文件列表:['template', '$']
其中jquery在没有使用define包裹的情况下,mod也能正常把jquery文件插入到dom节点中,但问题是此时的callback是没有运行的,也没有任何报错提示
仅仅是因为代码中if (0 == needNum--)值不相同,是jquery没有使用mod的define函数导致,
在此种情况下建议mod进行一个判断,至少给一个console报错提示,
此时不是异步加载的文件没有加载完毕,而是因为加载的文件不符合define包裹条件而没有执行正常callback。
这对于代码调试来说很有必要!!!

配置
fis.hook('commonjs', {
  paths: {
    $: 'static/lib/jquery.min.js'
  }
});
...

//异步加载
require(['template', '$'], function(template, jq){
        console.log(template({'name': 'abc'}));
        console.log(jq);
}, function(err){
        console.log(arguments);
});
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

1 participant