github web-infra-dev/rspack v2.2.0-beta.1

pre-release3 hours ago

Highlights

RSC: Client Component CSS now uses Flight preinit

Rspack now emits Client Component exports as registered client references directly. CSS imported by a Client Component is no longer injected by wrapping its exports with generated <link> elements; the stylesheet is preinitialized from the React Flight payload instead. This preserves client-reference identity, including default, named, CommonJS, and non-component exports. Explicit link generation remains available through import.meta.rspackRsc.loadCss().

This is a breaking change for RSC framework integrations. Upgrade react-server-dom-rspack to 0.1.0 and update any code that relies on the previous export-wrapper behavior.

SWC 77: Wasm plugins must be rebuilt

swc_core is upgraded from 76 to 77, which changes the serialized AST encoding across the SWC Wasm plugin boundary. Plugins compiled against an earlier SWC schema no longer load and the build fails with The version of the SWC Wasm plugin you're using might not be compatible with 'builtin:swc-loader'. Rebuild your plugin, or upgrade to an SWC 77 compatible release .

Use plugins.swc.rs to find the plugin version matching your Rspack release, and see SWC plugin version mismatch for details. SWC 77 also introduces dedicated FunctionBody and ArrowFunctionBody::FunctionBody AST nodes, a breaking change for Rust-side consumers of the SWC AST.

CSS Modules: standards-aligned Unicode identifiers

CSS identifier escaping and unescaping now follow the CSS Syntax standard, so Unicode identifiers are emitted directly instead of carrying unnecessary backslashes.

.😍 {
  color: red;
}

now generates .style_modules_css-😍 rather than .style_modules_css-\😍.

CSS Modules coverage also expands to more webpack cases — local/global modes, generator options, ICSS @value, custom identifiers, and warning order — and dependency collection moves into css-module-lexer, so stylesheets are no longer rescanned with regular expressions after parsing.

What's Changed

Breaking Changes 🍭

New Features 🎉

  • feat: implement generation-based memory cache eviction by @ahabhgk in #15181
  • feat: add idle cache compaction with interruption handling by @ahabhgk in #15182
  • feat(css): improve unicode handling and support more css modules cases, boost performance by @intellild in #14809

Performance 🚀

Bug Fixes 🐞

  • fix: pass HMR error to Preact refresh recovery handler by @chenjiahan in #15179
  • fix(cache): limit shutdown compaction to a single pass by @ahabhgk in #15188
  • fix(types): add missing stats fields by @chenjiahan in #15206
  • fix(css-extract): strip BOM from module content before concatenation by @doxxx93 in #15169
  • fix(core): decouple incremental artifacts from cache! by @hardfist in #15229
  • fix(asset): preserve ESM imports in module output for "preserve" importMode by @JSerFeng in #15165

Refactor 🔨

Document 📖

Other Changes

New Contributors

Full Changelog: v2.1.10...v2.2.0-beta.1

Don't miss a new rspack release

NewReleases is sending notifications on new releases.