github:https://github.com/webpack-contrib/webpack-bundle-analyzer
1.安装:
cnpm install webpack-bundle-analyzer --save-dev
2.在 vue.config.js 中:
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin; module.exports = { configureWebpack: { plugins: [new BundleAnalyzerPlugin()] } }
3.执行 npm run serve 或者 npm run build 指令,会自动打开浏览器,显示对应开发环境或压缩环境的分析图