Browse Source

chore: 📦 Add bundle-stats and relative-ci (#25501)

* 📦 Add bundle-stats and relative-ci

* bundle-stats-webpack-plugin
pull/25503/head
偏右 4 years ago
committed by GitHub
parent
commit
17dd94fd07
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      .bundle-analyzerrc.json
  2. 4
      package.json
  3. 10
      webpack.config.js

14
.bundle-analyzerrc.json

@ -1,14 +0,0 @@
{
"files": [
{
"test": "./dist/antd.min.js",
"maxSize": "300 kB",
"compression": "gzip"
},
{
"test": "./dist/antd.min.css",
"maxSize": "65 kB",
"compression": "gzip"
}
]
}

4
package.json

@ -108,6 +108,7 @@
"@ant-design/icons": "^4.2.1",
"@ant-design/react-slick": "~0.26.1",
"array-tree-filter": "^2.1.0",
"bundle-stats": "^2.2.0",
"classnames": "^2.2.6",
"copy-to-clipboard": "^3.2.0",
"lodash": "^4.17.13",
@ -152,8 +153,8 @@
"@ant-design/colors": "^4.0.0",
"@ant-design/hitu": "^0.0.0-alpha.13",
"@ant-design/tools": "^9.0.0",
"@bundle-analyzer/webpack-plugin": "^0.5.1",
"@qixian.cs/github-contributors-list": "^1.0.3",
"@relative-ci/agent": "^1.3.0",
"@stackblitz/sdk": "^1.3.0",
"@types/classnames": "^2.2.8",
"@types/enzyme": "^3.10.5",
@ -179,6 +180,7 @@
"bisheng-plugin-description": "^0.1.4",
"bisheng-plugin-react": "^1.1.0",
"bisheng-plugin-toc": "^0.4.4",
"bundle-stats-webpack-plugin": "^2.2.0",
"bundlesize": "^0.18.0",
"chalk": "^4.0.0",
"cheerio": "^1.0.0-rc.3",

10
webpack.config.js

@ -3,7 +3,8 @@
const getWebpackConfig = require('@ant-design/tools/lib/getWebpackConfig');
const IgnoreEmitPlugin = require('ignore-emit-webpack-plugin');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const BundleAnalyzerPluginCom = require('@bundle-analyzer/webpack-plugin');
const { BundleStatsWebpackPlugin } = require('bundle-stats-webpack-plugin');
const { RelativeCiAgentWebpackPlugin } = require('@relative-ci/agent');
const EsbuildPlugin = require('esbuild-webpack-plugin').default;
const darkVars = require('./scripts/dark-vars');
const compactVars = require('./scripts/compact-vars');
@ -53,15 +54,16 @@ function injectWarningCondition(config) {
});
}
function addBundleAnalyzerPluginCom(config) {
function addBundleStatsWebpackPlugin(config) {
if (!process.env.CIRCLECI || process.env.RUN_ENV !== 'PRODUCTION') {
return;
}
config.plugins.push(
new BundleAnalyzerPluginCom({
new BundleStatsWebpackPlugin({
token: process.env.BUNDLE_ANALYZER_TOKEN,
}),
);
config.plugins.push(new RelativeCiAgentWebpackPlugin());
}
function processWebpackThemeConfig(themeConfig, theme, vars) {
@ -122,7 +124,7 @@ if (process.env.RUN_ENV === 'PRODUCTION') {
}),
);
addBundleAnalyzerPluginCom(config);
addBundleStatsWebpackPlugin(config);
});
processWebpackThemeConfig(webpackDarkConfig, 'dark', darkVars);

Loading…
Cancel
Save