|
|
@ -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); |
|
|
|