我有很多模块.一个模块加载另一个模块,该模块加载另一个模块等等…
当然,当我加载页面时,所有这些模块都会加载.它完美地运作.没有优化器. (即使它需要一分钟,因为浏览器必须加载50件事).
当我在我的app.build.js中使用优化器时,似乎我必须手动指定每个模块!
为什么优化器无法自动遍历模块?
解决方法
您只需指定要优化的模块,而不是其依赖项.来自文档:
In the modules array,specify the module names that you want to
optimize,in the example,“main”. “main” will be mapped to
appdirectory/scripts/main.js in your project. The build system will
then trace the dependencies for main.js and inject them into the
appdirectory-build/scripts/main.js file.
({ appDir: "../",baseUrl: "scripts",dir: "../../appdirectory-build",modules: [ { name: "main" } ] })
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。