vux-cli3 项目文件分析 webpack-bundle-analyzer
安装
cnpm install webpack-bundle-analyzer -D
修改vue.config.js
module.exports = { chainWebpack: config => { if (process.env.use_analyzer) { // 分析 config .plugin('webpack-bundle-analyzer') .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin) } } }
安装 windows下不支持xxx=xxx这种写法。为了支持这种写法,用npm安装cross-env
cnpm install --save-dev cross-env
修改package.json
"scripts": {
"analyzer": "cross-env use_analyzer=true npm run serve"
},
然后运行npm run analyzer
打开 http://127.0.0.1:8888/