# 性能分析
# 1. 速度分析
Speed Measure Plugin (opens new window)
- 安装
yarn add -D speed-measure-webpack-plugin
- 代码示例
const SpeedMeasurePlugin = require("speed-measure-webpack-plugin");
const smp = new SpeedMeasurePlugin();
const webpackConfig = smp.wrap({
plugin: [new Myplugin(), new MyOtherPlugin()],
});
# 2. 体积分析
webpack-bundle-analyzer (opens new window)
yarn add -D webpack-bundle-analyzer
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
.BundleAnalyzerPlugin;
module.exports = {
plugins: [new BundleAnalyzerPlugin()],
};