From 4cfaa576559e8116194b8778de91969a60f0c4b5 Mon Sep 17 00:00:00 2001 From: Ryan Albrecht Date: Mon, 14 Sep 2026 09:49:10 -0700 Subject: [PATCH 1/4] build: Fix pnpm build-profile and ignore the output file --- .gitignore | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8b13ff22d140..82e5977f182b 100644 --- a/.gitignore +++ b/.gitignore @@ -66,6 +66,7 @@ yalc.lock ngrok.yml package-lock.json yarn.lock +stats.rspack.json .claude/settings.local.json .claude/launch.json .claude/plans diff --git a/package.json b/package.json index 03d614c43d81..b970d335b5e9 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "build": "NODE_OPTIONS='--max-old-space-size=4096' rspack --config ./rspack.config.ts", "build-js-loader": "node scripts/build-js-loader.ts", "build-js-po": "node build-utils/ts-extract-gettext.ts", - "build-profile": "rspack --profile --json > stats.json", + "build-profile": "rspack --json > stats.rspack.json", "extract-form-fields": "node scripts/extractFormFields.ts", "gen:embed-widgets": "esbuild scripts/genEmbedWidgets.ts --bundle --platform=node --format=esm --packages=external --outfile=.artifacts/genEmbedWidgets.mjs && node .artifacts/genEmbedWidgets.mjs", "gen:platform-info": "node scripts/genPlatformProductInfo.ts", From 7ac4af1b89f17242006bfb968dad726d7d6e39b4 Mon Sep 17 00:00:00 2001 From: Ryan Albrecht Date: Mon, 14 Sep 2026 10:43:08 -0700 Subject: [PATCH 2/4] build: Emit bundle-shape stats from build-profile `rspack --json` takes its stats options from the config, and the CLI has no flag to override them. Under `--mode production` the default preset drops to errors and warnings, so the file carried no assets, chunks, or entrypoints. Without that flag the default preset dumps every module with its source and the file grows past 300MB, which no analyzer will open. RSPACK_STATS gates a trimmed stats object on both configs, so build-profile now writes a ~3MB file holding the asset, chunk, and entrypoint data. Claude-Session: https://claude.ai/code/session_01Jp2jDjcwahdDYBBSmWFVXc --- package.json | 2 +- rspack.config.ts | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index b970d335b5e9..80d2a1aed45b 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "build": "NODE_OPTIONS='--max-old-space-size=4096' rspack --config ./rspack.config.ts", "build-js-loader": "node scripts/build-js-loader.ts", "build-js-po": "node build-utils/ts-extract-gettext.ts", - "build-profile": "rspack --json > stats.rspack.json", + "build-profile": "RSPACK_STATS=1 NODE_ENV=production rspack --mode production --config ./rspack.config.ts --json=stats.rspack.json", "extract-form-fields": "node scripts/extractFormFields.ts", "gen:embed-widgets": "esbuild scripts/genEmbedWidgets.ts --bundle --platform=node --format=esm --packages=external --outfile=.artifacts/genEmbedWidgets.mjs && node .artifacts/genEmbedWidgets.mjs", "gen:platform-info": "node scripts/genPlatformProductInfo.ts", diff --git a/rspack.config.ts b/rspack.config.ts index 8a38a2937d4e..7931247f4e30 100644 --- a/rspack.config.ts +++ b/rspack.config.ts @@ -990,4 +990,25 @@ if (env.WEBPACK_CACHE_PATH) { } const configs = [appConfig, workerConfig]; + +// `--json` defaults to dumping every module with its source, which is too large to +// open in an analyzer. Restrict the output to the bundle shape when profiling. +if (env.RSPACK_STATS) { + for (const config of configs) { + config.stats = { + all: false, + assets: true, + chunks: true, + chunkRelations: true, + chunkGroups: true, + entrypoints: true, + hash: true, + timings: true, + version: true, + errors: true, + warnings: true, + }; + } +} + export default configs; From 3608e78621ce86e1743da8c3682ac0ca04dd96c5 Mon Sep 17 00:00:00 2001 From: Ryan Albrecht Date: Tue, 15 Sep 2026 11:18:11 -0700 Subject: [PATCH 3/4] Update rspack.config.ts Co-authored-by: Scott Cooper --- rspack.config.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rspack.config.ts b/rspack.config.ts index 7931247f4e30..f15178f86dc0 100644 --- a/rspack.config.ts +++ b/rspack.config.ts @@ -997,6 +997,9 @@ if (env.RSPACK_STATS) { for (const config of configs) { config.stats = { all: false, + modules: true, + nestedModules: true, + source: false, assets: true, chunks: true, chunkRelations: true, From fa13ecf80aa7ca7c73d7b2933aaed8864d8522b5 Mon Sep 17 00:00:00 2001 From: Ryan Albrecht Date: Tue, 15 Sep 2026 11:18:20 -0700 Subject: [PATCH 4/4] Update rspack.config.ts Co-authored-by: Scott Cooper --- rspack.config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rspack.config.ts b/rspack.config.ts index f15178f86dc0..1c9fe7fd930c 100644 --- a/rspack.config.ts +++ b/rspack.config.ts @@ -991,8 +991,8 @@ if (env.WEBPACK_CACHE_PATH) { const configs = [appConfig, workerConfig]; -// `--json` defaults to dumping every module with its source, which is too large to -// open in an analyzer. Restrict the output to the bundle shape when profiling. +// Configure JSON stats explicitly; the CLI defaults to errors and warnings. +// Keep module detail for bundle analysis without embedding source text. if (env.RSPACK_STATS) { for (const config of configs) { config.stats = {