Highlights
Faster ESM output builds
Building with output.module is now much faster.
A lodash-es production build went from 503.8 ms to 161.6 ms (-67.9%).
Fine-grained import.meta parser options
module.parser.javascript.importMeta now accepts an object so each known import.meta property can be configured independently, on top of the existing true / false / 'preserve-unknown' values. Properties set to false are preserved for runtime evaluation, omitted properties keep their default behavior, and unknown properties are preserved. Both webpack-compatible keys (dirname, filename, main, url, webpack, webpackContext) and Rspack-specific keys (rspackHash, rspackPublicPath, glob, ...) are supported.
export default {
module: {
parser: {
javascript: {
importMeta: {
// keep `import.meta.url` for runtime evaluation
url: false,
// keep the compile-time replacement of `import.meta.webpack`
webpack: true,
},
},
},
},
};Static worker URL output
module.parser.javascript.worker now accepts an object form with alias and url, alongside the existing boolean and string[] forms. With url: 'new-url-relative' and output.module enabled, Rspack emits a static new URL() expression for new Worker(new URL(..., import.meta.url)) instead of runtime code, honoring output.publicPath and output.workerPublicPath.
export default {
output: {
module: true,
chunkFilename: '[name].bundle.js',
},
module: {
parser: {
javascript: {
worker: {
url: 'new-url-relative',
},
},
},
},
};new Worker(new URL('./worker.js', import.meta.url));
// would become 👇
new Worker(new URL('./worker.bundle.js', import.meta.url));What's Changed
New Features 🎉
- feat(runtime): support logical assignment for chunk loading global by @fireairforce in #14655
- feat: support persistent cache for module hashes by @ahabhgk in #14717
- feat: support static worker new URL output by @intellild in #14728
- feat: support fine-grained import.meta parser options by @intellild in #14631
Performance 🚀
- perf(swc): enable parallel wasmtime compilation by @hardfist in #14716
- perf(hook): reduce hook macro expansion size and optimize performance by @intellild in #14633
- perf: optimize ESM linking passes by @JSerFeng in #14758
- perf: deduplicate repeated dynamic reexport code by @JSerFeng in #14748
Bug Fixes 🐞
- fix(ci): pick binary-size base by build-triggering commit by @stormslowly in #14715
- fix: clean up runtime global rendering by @LingyuCoder in #14735
- fix(binding): clean up chunk wrappers when compiler is GCed by @SyMind in #14736
- fix: enable runtime mode esm context imports by @LingyuCoder in #14740
- fix: revert Module Federation runtime identifiers by @LingyuCoder in #14761
- fix(fs): include paths in native filesystem errors by @hardfist in #14760
- fix: respect RSPACK_BINDING in loader workers by @hardfist in #14775
- fix: invalidate the target compiler for lazy compilation by @Kanary-channelio in #14781
Refactor 🔨
- refactor(binding): avoid unsafe compilation access in chunk and module by @SyMind in #14671
- refactor: avoid runtime module iife in rspack mode by @LingyuCoder in #14700
- refactor: colocate rspack runtime lexical globals by @LingyuCoder in #14703
- refactor: rename empty context helpers by @LingyuCoder in #14733
- refactor(cli): use @rstackjs/load-config by @chenjiahan in #14738
- refactor: use rspack runtime identifiers by @LingyuCoder in #14739
- refactor: unify runtime globals render modes by @LingyuCoder in #14762
Other Changes
- chore(ci): surface Windows Defender status after disable attempt by @stormslowly in #14711
- chore(ci): read binary-size data via authenticated API by @stormslowly in #14730
- chore(deps): update patch npm dependencies by @renovate[bot] in #14751
- chore(deps): update dependency @rslint/core to v0.6.5 by @renovate[bot] in #14749
- chore(deps): update dependency @module-federation/runtime-tools to v2.7.0 by @renovate[bot] in #14752
- chore(deps): update dependency webpack-sources to v3.5.1 by @renovate[bot] in #14750
- revert: "feat: support persistent cache for module hashes" by @ahabhgk in #14763
New Contributors
- @Kanary-channelio made their first contribution in #14781
Full Changelog: v2.1.3...v2.1.4