mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
chore: 📦 Add bundle-stats and relative-ci (#25501)
* 📦 Add bundle-stats and relative-ci
* bundle-stats-webpack-plugin
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user