先安装yarn add webpack-bundle-analyzer;
在vue.config.js里边添加下边代码:
module.exports = {
chainWebpack: config => {
config
.plugin('webpack-bundle-analyzer')
.use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
}
}
package.json里边增加脚本:
"scripts": {
"report": "yarn run serve"
}
执行yarn report即可看到资源所占大小