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

data-main的入口被拆解 #32

Open
lococo--0 opened this issue Nov 30, 2015 · 4 comments
Open

data-main的入口被拆解 #32

lococo--0 opened this issue Nov 30, 2015 · 4 comments

Comments

@lococo--0
Copy link

requirejs通过data-main来确定主入口的,用data-main来定义的主入口相当于直接require主入口调起回调。

而loader把data-main的js文件直接拆解成script的形式进行引入,会导致main函数无法执行。

@2betop
Copy link
Contributor

2betop commented Dec 1, 2015

其实应该不是 loader 的问题,是 fis3-hook-amd 里面把 data-main 目标资源当同步依赖了,这个应该是不对的。应该是异步依赖。

@2betop
Copy link
Contributor

2betop commented Dec 1, 2015

仔细想了下,确实是不对,应该是异步依赖,更新下 [email protected]

@lococo--0
Copy link
Author

棒!相当然的以为拆分、添加script的行为是loader的功能。

其实为什么loader和hook要分开 ·· 感觉两个功能联系的很紧 ·· 用到hook的话一定会用resource_map的吧

@2betop
Copy link
Contributor

2betop commented Dec 1, 2015

因为 loader 这层逻辑可以在后端更好的实现,在跟后端打通的项目里面,不需要 loader 插件。

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