webpack-bundle-analyzer打包文件分析工具
一、安装
npm intall webpack-bundle-analyzer –save-dev
二、配置
在build/webpack.prod.config.js中的module.exports = webpackConfig这句话的上面增加
if (config.build.bundleAnalyzerReport) {
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
}
三、运行
使用命令npm run build --report
四、结果


浙公网安备 33010602011771号