/
githubmirror
/
grafana
Обзор
Документация
Войти
/
githubmirror
/
grafana
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
scripts/webpack/webpack.stats.ts
68 строк
2 KB
Matt Cowley
CI: Ignore parallel configs in webpack stats config (#129894)
03 авг 2026, 10:45
Не верифицирован
03 авг 2026, 10:45
bde82a9
Код
Авторство
О чём код?
import { RsdoctorWebpackPlugin } from '@rsdoctor/webpack-plugin'; import type { Configuration } from 'webpack'; import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'; import { merge } from 'webpack-merge'; import { FilterStatsPlugin } from './plugins/FilterStatsPlugin.ts'; import type { Env } from './webpack.common.ts'; import prodConfig from './webpack.prod.ts'; export default (env: Env = {}) => { const bundleAnalyzerOpts: BundleAnalyzerPlugin.Options = env.filtered ? { analyzerMode: 'static', reportFilename: 'bundle-stats.html', openAnalyzer: false, generateStatsFile: false, } : {}; const config: Configuration = { plugins: [new BundleAnalyzerPlugin(bundleAnalyzerOpts)], }; // yarn build:smolstats if (env.filtered) { config.plugins?.push( new FilterStatsPlugin({ exclude: /@kusto|monaco-editor|public\/locales/, minDominance: 0.75, }) ); } // yarn build:stats --env doctor if (env.doctor) { config.plugins?.push(new RsdoctorWebpackPlugin()); } // disable hashing in output filenames to make them easier to identify // yarn build:stats --env doctor --env namedChunks if (env.namedChunks) { config.optimization = { chunkIds: 'named', }; config.output = { filename: '[name].js', chunkFilename: '[name].js', }; } const baseConfig = prodConfig(env); if (Array.isArray(baseConfig)) { // yarn build:stats --env configName=swagger if (!env.configName) { env.configName = baseConfig[0].name; } const namedConfig = baseConfig.find((c) => c.name === env.configName); if (!namedConfig) { throw new Error(`No config found with name ${env.configName}`); } return merge(namedConfig, config); } return merge(baseConfig, config); };