npm run build 打包优化

2019-10-14  本文已影响0人  有梦想的妞

1、优化之前 是 

2、去掉console.log、警告、注释、debugger

参照:https://blog.csdn.net/lmy0111ly/article/details/93979006

https://www.cnblogs.com/jishugaochao/p/10180416.html

    webpack.prod.conf中UglifyJsPlugin配置

线上去掉查看源码功能:sourceMap:false

去掉注释 :comments:false,

缓存:cache:true,

去掉console.log\警告、注释、debugger

drop_console: true, drop_debugger:true, pure_funcs: ['console.log']

优化了一大半 

3. 关闭Prefetch

4、启用DllPlugin和DllReferencePlugin预编译库文件

参照:https://juejin.im/post/5a622613f265da3e5342475c

5、minChunks: 3

上一篇 下一篇

猜你喜欢

热点阅读