fis3-hook-module icon indicating copy to clipboard operation
fis3-hook-module copied to clipboard

globalAsyncAsSync: true 只有在 require('jquery') 才起作用,require(['jquery']) 时无效

Open hanai opened this issue 9 years ago • 9 comments

<script>
require('jquery');
</script>

globalAsyncAsSync: true 只有在 require('jquery') 才起作用,require(['jquery']) 时无效

hanai avatar Jul 09 '15 06:07 hanai

亲,你是用 amd 方案吗?

2betop avatar Jul 09 '15 07:07 2betop

是的

hanai avatar Jul 09 '15 08:07 hanai

的确,我也遇到了。 是设计如此么?

ccqgithub avatar Aug 10 '15 10:08 ccqgithub

直接这样的话

<script type="text/javascript">
    require('page/index')();
</script>

由于requireJs不允许在全局调用require,所以会报错,如果改成 require(['page/index'])这样的话,资源只能异步加载。。

ccqgithub avatar Aug 11 '15 07:08 ccqgithub

当 mode 为 amdglobalAsyncAsSync 为 true 时,应该是自动变成同步才对,如果不是那就是 bug

2betop avatar Aug 11 '15 07:08 2betop

@2betop 确认:

// https://github.com/fex-team/fis3-hook-module
fis.hook('module', {
    wrap: 'amd',
    mode: 'amd',
    baseUrl: './static/',
    paths: {},
    packages: [],
    forwardDeclaration: true,
    skipBuiltinModules: false,
    globalAsyncAsSync: true,
    extList: ['.js', '.coffee', '.jsx']
});

ccqgithub avatar Aug 11 '15 07:08 ccqgithub

好的,今天没有时间修,预计明天修复!

2betop avatar Aug 11 '15 07:08 2betop

hello, 请更新到 [email protected]

2betop avatar Aug 12 '15 02:08 2betop

@2betop 好的,3q

ccqgithub avatar Aug 12 '15 06:08 ccqgithub