What's Changed
Highlights 💡
Support import.meta style module variables
Rspack now exposes more module variables through import.meta, which aligns better with the ESM specification than CommonJS-style injected globals. When authoring ESM modules, import.meta is now the recommended way to access these runtime values.
The newly supported import.meta properties are:
| New import.meta API | Existing runtime variable |
|---|---|
import.meta.rspackPublicPath
| __webpack_public_path__
|
import.meta.rspackBaseUri
| __webpack_base_uri__
|
import.meta.rspackShareScopes
| __webpack_share_scopes__
|
import.meta.rspackInitSharing
| __webpack_init_sharing__
|
import.meta.rspackNonce
| __webpack_nonce__
|
import.meta.rspackUniqueId
| __rspack_unique_id__
|
import.meta.rspackVersion
| __rspack_version__
|
import.meta.rspackHash
| __webpack_hash__
|
New Features 🎉
- feat: support
import.metastyle module variables (#14539 by @LingyuCoder)
Performance 🚀
- perf: deduplicate runtime module macro glue (#14620 by @intellild)
- perf: avoid cloning side effects artifact in module concatenation (#14622 by @hardfist)
Bug Fixes 🐞
- fix(browser): inject runtime require into browser MF runtime (#14590 by @CPunisher)
- fix(ci): build wasm in release debug so the wasm binding gets published (#14614 by @stormslowly)
- fix(rslib): preserve import phase in dynamic import external rendering (#14615 by @elecmonkey)
- fix: empty references export for cjs and dynamic import tree shaking (#14629 by @ahabhgk)
Document 📖
- docs: document asset/resource emit generator option (#14602 by @chenjiahan)
- docs: document json parser parse option (#14606 by @chenjiahan)
- docs: document more rule use options (#14610 by @chenjiahan)
- docs: update module variable docs for import.meta (#14618 by @LingyuCoder)
- docs: enable Rspress anchor checks (#14627 by @chenjiahan)
Other Changes
- chore(deps): update patch npm dependencies (#14595 by @renovate[bot])
- chore(deps): update dependency @babel/preset-react to ^7.29.7 (#14597 by @renovate[bot])
- chore(deps): update dependency @ast-grep/napi to ^0.44.0 (#14596 by @renovate[bot])
- chore(deps): update dependency @rsbuild/core to v2.1.1 (#14603 by @renovate[bot])
- chore(deps): update dependency @rspack/dev-server to ^2.1.0 (#14604 by @renovate[bot])
- chore(deps): update dependency @shikijs/transformers to ^4.3.0 - autoclosed (#14605 by @renovate[bot])
- chore(deps): update dependency mermaid to ^11.16.0 (#14607 by @renovate[bot])
- chore(deps): update dependency ts-checker-rspack-plugin to ^1.5.1 (#14608 by @renovate[bot])
- chore(deps): update dependency @rsbuild/plugin-sass to v2 (#14609 by @renovate[bot])
- chore: remove obsolete perf agent skills (#14613 by @hardfist)
Full Changelog: v2.1.1...v2.1.2