可视化分析打包大小

发布于 2021-02-27  771 次阅读


webpack-bundle-analyzer

可视化分析包大小插件
1. npm install webpack-bundle-analyzer --save-dev 安装
2. 修改webpack.config.js文件

// 引入
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; 
module.exports = { 
        plugins: [ 
                // 开启 BundleAnalyzerPlugin 
                new BundleAnalyzerPlugin(), 
    ],
};
  1. npm run build 打包文件后会自动打开 http://127.0.0.1:8888/该地址即可查看

I struggle for what I love, so I can be happy here.