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

异步加载变量ModuleId无法生成path #33

Open
lococo--0 opened this issue Dec 1, 2015 · 5 comments
Open

异步加载变量ModuleId无法生成path #33

lococo--0 opened this issue Dec 1, 2015 · 5 comments

Comments

@lococo--0
Copy link

在我的fis-conf里有一段配置:

fis.match('/path/to/page1', {
  isMod: true,
  id: 'pages/page1'
});

在我的代码中

Case1:

var callback = function () {
  require(['pages/page1'], function (Module) { /* do stuff */ });
}

Case2:

var callback = function (moduleId) {
  require([moduleId], function (Module) { /* do stuff */ });
}

在case1的前提下,我的index.html中有pages/page1对应的resource_map:

require.config({paths: {
  "pages/page1": "/path/to/page1"
}})

但在case2我的pages/page1对应的resource_map就没有了

这样不科学啊 ·· 以前fis2用mod的时候,我通过require.async的方法是可以获取到所有resource_map的 ··
现在resource_map变小了,但是我这种情况要怎么解决呀

@lococo--0
Copy link
Author

@2betop 没有收到答复好难过

@2betop
Copy link
Contributor

2betop commented Dec 6, 2015

Case2是变量啊,不是字面量都分析不到,有两种方法解决这个问题,用fis的注释方式对所有可能的模块标记异步依赖,方式二,在load中有配置

@lococo--0
Copy link
Author

@2betop 你是说配置include么 ·· 主要以前fis2的loader会把所有的资源依赖都插入进依赖表里面,但现在我看好像是只会分析require的依赖树,而不是所有资源的依赖树了。

@2betop
Copy link
Contributor

2betop commented Dec 7, 2015

是 include, 你可以设置成 * 就是一样的效果了。

@lococo--0
Copy link
Author

@2betop !!!! 机智!!

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