-
Notifications
You must be signed in to change notification settings - Fork 0
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
Webpack 打包优化 #28
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
1. 配置 exclude / include
这里以 loader 为例,在
loader
解析时,指定或者排除某个目录2. noParse
防止
webpack
解析那些任何与给定正则表达式相匹配的文件。忽略的文件中不应该含有import
,require
,define
的调用,或任何其他导入机制。忽略大型的library
可以提高构建性能。3. IgnorePlugin
阻止生成用于导入的模块,或阻止与正则表达式或过滤器函数匹配的调用
moment 2.18 会将所有本地化内容和核心功能一起打包(见该 GitHub issue)。你可使用
IgnorePlugin
在打包时忽略本地化内容4. DLLPlugin 和 DLLReferencePlugin
DLLPlugin
和DLLReferencePlugin
用某种方法实现了拆分bundles
,提前将基本不会变的bundle
打包好,下一次打包的时候,不需要重复打包最后在
html
中插入react.dll.js
另外可以通过 html-webpack-tags-plugin 自动注入
DLL
到html
中5. Happypack
HappyPack 通过并行转换文件来加快初始Webpack的构建速度
6. optimization
The text was updated successfully, but these errors were encountered: