Minimal reproduction of a Rspack 1.x → 2.1.8 production build regression when minification and file-based source-map generation run together (v1 tested at latest 1.7.12).
When JS minification and file-based sourcemap generation run together, v2 spends several extra seconds in the SWC JS minimizer compared with v1. Minify alone and source maps alone are both fast on v2. The regression affects all file-based sourcemaps (hidden-source-map, source-map, cheap-source-map, etc.) but not eval-source-map (which embeds maps inline).
Cold production builds that emit large async chunks (~10 MB JS / ~30 MB maps) from real node_modules packages:
| Config | Rspack 1.7.12 | Rspack 2.1.8 |
|---|---|---|
| minify off, maps off | ~0.9s | ~0.5s |
| minify off, maps on | ~0.5s | ~0.4s |
| minify on, maps off | ~1.4s | ~1.3s |
| minify on, maps on | ~1.7s | ~8.2s |
Primary metric: wall time of both − minify (extra cost of generating source maps during minify):
| v1 | v2 | |
|---|---|---|
| both − minify | +0.30s | +6.95s (~23×) |
Synthetic small modules do not reproduce the gap. The workload needs large third-party code to minify (5+ MB source). The issue scales with module size: the SWC minimizer slows down disproportionately in v2 when source-map generation is enabled during minification of large files.
Generic to file-based sourcemaps: The regression is not specific to hidden-source-map. All file-based sourcemap types show the same ~7s overhead in v2:
hidden-source-map: 31.67× slowersource-map: 33.34× slowercheap-source-map: 50.07× slowercheap-module-source-map: 47.51× slower
Exception: eval-source-map (which embeds maps inline) shows no regression, suggesting the bottleneck is in file I/O or sourcemap file generation, not in source-map data structure handling.
npm installRspack 1.7.12 and 2.1.8 are installed side-by-side via npm aliases.
Main benchmark (hidden-source-map only, ~30 seconds):
npm run bench # minify × source-map matrix for v1 then v2Extended benchmark (all sourcemap types, ~3 minutes):
npm run bench:all-devtools # test hidden-source-map, source-map, cheap-source-map, etc.Individual builds:
| Script | MINIFY |
SOURCEMAP |
DEVTOOL |
|---|---|---|---|
build:v*:none |
off | off | — |
build:v*:maps |
off | on | hidden-source-map (default) |
build:v*:minify |
on | off | — |
build:v*:both |
on | on | hidden-source-map (default) |
To test a different sourcemap type on a single build:
DEVTOOL=source-map npm run build:v1:both
DEVTOOL=cheap-source-map npm run build:v2:both
DEVTOOL=eval-source-map npm run build:v2:bothAvailable npm scripts:
npm run bench # Main: v1 + v2, hidden-source-map only
npm run bench:v1 # v1 only, hidden-source-map
npm run bench:v2 # v2 only, hidden-source-map
npm run bench:all-devtools # Both versions, all 5 sourcemap types (~3 min)
npm run bench:all-devtools:v1 # v1 only, all devtools
npm run bench:all-devtools:v2 # v2 only, all devtools
npm run bench:analyze # Show last benchmark summaryResults append to bench-results.jsonl (gitignored). After a benchmark run, view the summary:
npm run bench:analyze- SWC TypeScript parsing (no transform)
optimization.minimize: true/ configurabledevtool- ESM output (
output.module: true+html.scriptLoading: 'module') cache: falseruntimeChunk: 'single'
Sourcemaps tested:
hidden-source-map,source-map,cheap-source-map,cheap-module-source-map(all show ~30–50× regression)eval-source-map(no regression observed)
Entry: a simple app that imports white-web-sdk (~5 MB) to create a large bundle that triggers the minimizer slowdown.
"@rspack/core-v1": "npm:@rspack/core@1.7.12",
"@rspack/core-v2": "npm:@rspack/core@2.1.8"