安装插件 webpack-bundle-analyzer
npm install webpack-bundle-analyzer --save-dev
开启开关 config/index.js
当然,也可以把开关作为配置参数
build: {
//操作系统的环境变量
//bundleAnalyzerReport: process.env.npm_config_report
bundleAnalyzerReport: true
}
执行命令
npm run build
页面自动跳出
http://127.0.0.1:8888
可以看到 vendor 文件是最大的,其包含的内容有 mock.js 、element-ui.common.js