webpack-bundle-analyzer插件的使用方式

第一步: 

npm install --save-dev webpack-bundle-analyzer

第二步:

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

 

转载于:https://www.cnblogs.com/hspl/p/11133808.html

你可能感兴趣的:(webpack)