跪拜 Guibai
← All articles
Frontend · JavaScript · GitHub

Rspack 2.3 lands SWC Next parser, new cache, and leaner bundles

By WebInfra ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Build tooling is getting meaningfully faster and more memory-efficient for teams running multiple dev servers or large monorepos. The shift toward SWC Next's flat AST could rewrite how custom transforms are written, letting developers keep JavaScript ergonomics without paying a cross-language performance penalty.

Summary

Rspack 2.3 brings the SWC Next parser into its Rust core, replacing the JavaScript parser with a flat ESTree AST that cuts parsing time by up to 14% and instruction counts by up to 24% on large bundles. The new architecture also paves the way for JavaScript-authored transform plugins that run at native speed, with loader support expected in Rspack 2.4 or 2.5.

The release targets memory pressure, a real problem when multiple build processes run in parallel. Peak RSS drops 27% to 36% across build and dev scenarios, and a new allocative-based snapshot tool helps pinpoint hotspots. SplitChunks gains a dedupDepth option (default on in production) that found 2.4% to 9.9% Brotli-size savings in two large real projects, plus minRemainingSize to avoid tiny leftover chunks.

A redesigned experimental cache cuts disk usage by about 79%, defers writes to idle time, and separates dev and production caching. Loader-level caching is particularly effective: babel-loader with 10,000 modules drops from 63.8s to 11.2s. A new codeFilter skips loader calls when source doesn't match a regex, cutting a 622ms build to 481ms when only 10% of modules need transformation. CSS improvements include standalone style entries, external resource handling, and rspackIgnore comments.

Takeaways
— SWC Next native parsing benchmarks up to 3x faster than SWC; using the JavaScript API, up to 10x faster.
— three.js parsing time drops 14% and instruction count 24% after integrating SWC Next; React 10k shows 6% time and 11% instruction reductions.
— Memory RSS reductions in Rspack 2.3.0: build peak 27.4%, build end 36.5%, dev startup 33.8%, steady-state 34.8%.
— Overall build performance improves about 5% on average, up to 20% on some large projects.
— splitChunks.dedupDepth defaults to 1 in production and reduced client JS/CSS bundle size by 2.4% and 9.9% in two real projects.
— New experimental cache reduces disk usage by about 79% and cold-build peak memory by 16%, though hot builds get slightly slower.
— Loader caching for babel-loader on 10,000 modules: 63.8s to 11.2s with parallelism off (5.7x), 28.5s to 11.9s with parallelism on (2.4x).
— codeFilter on a 10,000-module test where only 10% needed transformation skipped 90% of loader calls and cut full build from 622ms to 481ms (23%).
— Rslib 1.0 is released, adding inline Wasm support and TypeScript 7.1 Beta content mappers.
— Rsdoctor 2.0 cuts install size 56%, analysis time 57%, and dev-mode HMR time 47%.
— Rspress 2.1.0 enables WebMCP by default, letting browser agents query documentation sites.
— TanStack CLI now supports creating TanStack Start projects with Rsbuild; create-rsbuild adds a Lynx template.
— Rsbuild file size reports now include Brotli compressed sizes and configurable compression levels.
Conclusions

SWC Next's flat ESTree AST is the key architectural bet: it avoids serialization overhead between Rust and JavaScript, which is what makes JavaScript-authored transform plugins viable at native speeds.

The new cache design directly addresses the pain of parallel builds—deferring writes and separating dev/prod caches is a pragmatic fix for teams running many dev servers, not just a micro-optimization.

codeFilter is a cheap but effective win because every JavaScript loader call in Rspack crosses a Rust/JavaScript boundary, so skipping calls based on source content pays off quickly on large codebases.

The memory reductions (up to 36%) align with the tighter AST layout from SWC Next, suggesting the parser migration is doing more than just speeding up parsing—it's shrinking the whole build footprint.

The ecosystem updates show the Rstack team is consolidating around Rsbuild as the central build tool, with Rslib reaching 1.0 and Rsdoctor adding AI-assisted analysis, all while keeping webpack compatibility a priority.

Concepts & terms
SWC Next
A next-generation JavaScript compiler from the SWC and Rstack teams. It uses a flat ESTree AST to balance speed, memory efficiency, and extensibility, and will become the next major SWC version.
codeFilter
A Rspack config option on loader rules that checks source content against a regex on the Rust side, skipping the loader call when no transformation is needed.
dedupDepth
A SplitChunks option in Rspack that searches for more shared module combinations across entries and pages, reducing duplicate bundling. Enabled by default at depth 1 in production.
WebMCP
A Chrome browser API that lets AI agents interact with web pages through a model context. Rspress 2.1.0 exposes documentation search and navigation tools through it.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗