-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
提高打包速度
- 针对耗时 loader,如 vue-loader, babel-loader 配置 cache-loader, thread-loader
- 合理使用
mode
参数和source-map
参数 - 缩小文件的搜索范围(配置 include exclude alias noParse extensions)
- 使用
happy-pack
开启多进程 loader 转换 - 使用 webpack-parallel-uglify-plugin 增强代码压缩
- 使用 DllPlugin 和 DllReferencePlugin 抽离第三方模块
优化打包文件体积
- 使用 webpack-bundle-analyzer 分析打包后的文件
- 对通过 script 外部引入(如 CDN)的库,我们在使用时依然通过 import 方式引入,但是不希望 webpack 将其打包进来,我们就可以通过配置
externals
的方式解决这个问题 - tree shaking