From 193bf0f6b42f80f1f2528ea5dc06b12d66d2ce4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Wed, 25 Dec 2019 15:18:31 +0800 Subject: [PATCH] add analysis (#20434) --- .npmignore | 1 + package.json | 1 + webpack.config.js | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/.npmignore b/.npmignore index 74b59e474c..f2f0cd0977 100644 --- a/.npmignore +++ b/.npmignore @@ -1 +1,2 @@ ~* +dist/report.html \ No newline at end of file diff --git a/package.json b/package.json index 9a08419370..841f528816 100644 --- a/package.json +++ b/package.json @@ -239,6 +239,7 @@ "stylelint-declaration-block-no-ignored-properties": "^2.1.0", "stylelint-order": "^3.0.0", "typescript": "~3.7.2", + "webpack-bundle-analyzer": "^3.6.0", "xhr-mock": "^2.4.1", "xhr2": "^0.2.0", "yaml-front-matter": "^4.0.0" diff --git a/webpack.config.js b/webpack.config.js index a8d2fff8f6..ddb56abb1e 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -3,6 +3,7 @@ const getWebpackConfig = require('@ant-design/tools/lib/getWebpackConfig'); const PacktrackerPlugin = require('@packtracker/webpack-plugin'); const IgnoreEmitPlugin = require('ignore-emit-webpack-plugin'); +const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; const { webpack } = getWebpackConfig; @@ -58,6 +59,10 @@ if (process.env.RUN_ENV === 'PRODUCTION') { fail_build: true, exclude_assets: name => !['antd.min.js', 'antd.min.css'].includes(name), }), + new BundleAnalyzerPlugin({ + analyzerMode: 'static', + openAnalyzer: false, + }), ); } });