webpack-bundle-analyzer文件大小分析工具
Angular cli 与webpack-bundle-anglyzer结合分析包大小。
一.安装
npm install --save-dev webpack-bundle-analyzer
二.配置
webpack.config.js
if (config.build.bundleAnalyzerReport) { const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin webpackConfig.plugins.push(new BundleAnalyzerPlugin()) }
三.启动
npm run-script build --report
浏览器打开127.0.0.1:8888地址可以看到一下效果图