Highlights 💡
-
Inline const with module declarations (#14032): Previously, Rspack only inlined constant exports from leaf modules in the module graph. Now constant exports from any module can be inlined, even when that module also imports or re-exports other modules. In rare circular-reference cases this can make a TDZ error disappear, but we do not expect real projects to rely on TDZ errors, so Rspack prioritizes the optimization.
// constants.js import './setup'; export const ENABLE_EXPERIMENT = false; // entry.js import { ENABLE_EXPERIMENT } from './constants'; if (ENABLE_EXPERIMENT) { runExperiment(); } // Before: constants.js is not a leaf module, so the branch could keep // reading the imported binding. if (ENABLE_EXPERIMENT) { runExperiment(); } // Now: the constant can still be inlined, so dead branches are easier // to remove. if (false) { runExperiment(); }
-
Tree shake namespace default reexport (#13980): Previously, the
import * as a from './a'; export default a;pattern did not tree-shakeathrough the default export. Now Rspack further analyzes the default-exported namespace object and can remove unused exports from the original namespace module.// a.js export function used() {} export function unused() {} // bridge.js import * as a from './a'; export default a; // app.js import a from './bridge'; a.used(); // Before: both used and unused could be kept in the bundle. // Now: unused can be tree-shaken.
-
CSS global module type (#13988):
css/globalis useful when most selectors in a stylesheet should stay global, but you still want CSS Modules features for selected local selectors. This makes it easier to migrate existing global CSS gradually without turning every class name into a local scoped name.export default { module: { rules: [{ test: /\.global\.css$/i, type: 'css/global' }], }, };
/* style.global.css */ .button { color: red; } :local(.title) { font-weight: 600; }
.buttonstays global, while.titleis renamed as a local class. -
CSS Modules local ident options (#14009): CSS Modules now support local ident hash options such as hash function, digest, digest length, and salt. These options make generated class names more configurable and better aligned with webpack-compatible CSS Modules setups.
export default { module: { rules: [{ test: /\.module\.css$/i, type: 'css/module' }], generator: { 'css/module': { localIdentName: '[name]__[local]__[hash]', localIdentHashFunction: 'xxhash64', localIdentHashDigest: 'hex', localIdentHashDigestLength: 8, localIdentHashSalt: 'my-salt', }, }, }, };
What's Changed
New Features 🎉
- feat(css): add support for css/global module type by @intellild in #13988
- feat: tree shake namespace default reexport by @JSerFeng in #13980
- feat: inline const with module declarations by @ahabhgk in #14032
- feat(css): support CSS module local ident options by @intellild in #14009
- feat: circular modules info plugin by @ahabhgk in #14031
Performance 🚀
- perf: cache reserved name atom set by @LingyuCoder in #14014
- perf: optimize flag dependency usage by @LingyuCoder in #14052
- perf(cli): remove process title startup overhead by @chenjiahan in #14061
- perf(deps): unify duplicate Rust dependencies to reduce binary size by @intellild in #14012
- perf: improve split chunks cache group filtering by @LingyuCoder in #14067
- perf: optimize mangle exports plugin by @LingyuCoder in #14048
- perf(cli): lazy load json stream helpers by @chenjiahan in #14079
- perf: optimize named id assignment by @LingyuCoder in #14075
Bug Fixes 🐞
- fix(rsc): skip client entry mismatch without injections by @SyMind in #14018
- fix(cli): write logger trace output to file by default by @hardfist in #14022
- fix(ci): repair broken rustup shim chain on macos-latest by @stormslowly in #14040
- fix(stats): preserve sub-millisecond precision in logger time entries by @stormslowly in #14049
- fix: import.meta.filename/dirname escape on windows by @ahabhgk in #14050
- fix(rsc): group client chunks by server-entry ownership by @SyMind in #13880
- fix(rslib): emit type-only isolated dts dependencies by @Timeless0911 in #14037
- fix(copy-plugin): support JS input file system for glob copies by @intellild in #14023
- fix: keep buildHttp imports bundled for node target by @SyMind in #14086
Document 📖
- docs: update config option types by @chenjiahan in #14060
- docs: update runtime plugin hooks by @chenjiahan in #14069
- docs(plugin-api): document module factory hooks by @chenjiahan in #14070
- docs(cli): update cli option descriptions by @chenjiahan in #14071
- docs(website): update core team profile by @chenjiahan in #14093
Other Changes
- security(ci): remove PR title lint workflow by @chenjiahan in #14016
- chore: add local rust benchmark script by @hardfist in #14007
- chore(ci): replace archived actions-rs/cargo with bare cargo invocations by @stormslowly in #14017
- chore: release version 2.0.3 by @LingyuCoder in #14015
- chore: add draft release notes skill by @chenjiahan in #14028
- chore(build): fix empty napi-binding.d.ts on subsequent builds by @stormslowly in #14027
- chore: bump rslint to 0.5.3 by @fansenze in #14034
- chore(deps): update swc crates by @hardfist in #14036
- chore(skill): add rspack performance optimization skill by @LingyuCoder in #14047
- chore: upgrade swc from 64 to 66 by @hardfist in #14059
- chore(deps): update dependency @codspeed/vitest-plugin to ^5.4.0 by @renovate[bot] in #14057
- chore(deps): update patch npm dependencies by @renovate[bot] in #14055
- chore(deps): update dependency @playwright/test to v1.60.0 by @renovate[bot] in #14058
- chore: bump patch of swc_core and swc_typescript by @CPunisher in #14066
- test: add named ids codspeed benchmarks by @LingyuCoder in #14074
- chore(security): replace issues helper action by @chenjiahan in #14084
- chore(deps): bump rstack ecosystem ci action by @chenjiahan in #14092
Full Changelog: v2.0.3...v2.0.4