当我们使用CommonsChunkPlugin插件时可以使用webpack-bundle-analyzer插件来分析分块是否达到我们的目地

 

安装

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

使用

在webpack.config.js里的plugins里加

module.exports = {
  plugins: [
    new BundleAnalyzerPlugin()
  ]
}

最后命令行启动

webpack --profile --json > stats.json

如果你是vue-cli 就使用

npm run build --report

webpack bundle analyzer zoomable treemap

This module will help you:

  1. Realize what's really inside your bundle
  2. Find out what modules make up the most of its size
  3. Find modules that got there by mistake
  4. Optimize it!1
posted on 2018-02-09 14:00  坚持不懈❥  阅读(622)  评论(0编辑  收藏  举报