Release Notes
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 https://github.com/web-infra-dev/rspack/pull/14655
- feat: support persistent cache for module hashes by @ahabhgk in https://github.com/web-infra-dev/rspack/pull/14717
- feat: support static worker new URL output by @intellild in https://github.com/web-infra-dev/rspack/pull/14728
- feat: support fine-grained import.meta parser options by @intellild in https://github.com/web-infra-dev/rspack/pull/14631
Performance 🚀
- perf(swc): enable parallel wasmtime compilation by @hardfist in https://github.com/web-infra-dev/rspack/pull/14716
- perf(hook): reduce hook macro expansion size and optimize performance by @intellild in https://github.com/web-infra-dev/rspack/pull/14633
- perf: optimize ESM linking passes by @JSerFeng in https://github.com/web-infra-dev/rspack/pull/14758
- perf: deduplicate repeated dynamic reexport code by @JSerFeng in https://github.com/web-infra-dev/rspack/pull/14748
Bug Fixes 🐞
- fix(ci): pick binary-size base by build-triggering commit by @stormslowly in https://github.com/web-infra-dev/rspack/pull/14715
- fix: clean up runtime global rendering by @LingyuCoder in https://github.com/web-infra-dev/rspack/pull/14735
- fix(binding): clean up chunk wrappers when compiler is GCed by @SyMind in https://github.com/web-infra-dev/rspack/pull/14736
- fix: enable runtime mode esm context imports by @LingyuCoder in https://github.com/web-infra-dev/rspack/pull/14740
- fix: revert Module Federation runtime identifiers by @LingyuCoder in https://github.com/web-infra-dev/rspack/pull/14761
- fix(fs): include paths in native filesystem errors by @hardfist in https://github.com/web-infra-dev/rspack/pull/14760
- fix: respect RSPACK_BINDING in loader workers by @hardfist in https://github.com/web-infra-dev/rspack/pull/14775
- fix: invalidate the target compiler for lazy compilation by @Kanary-channelio in https://github.com/web-infra-dev/rspack/pull/14781
Refactor 🔨
- refactor(binding): avoid unsafe compilation access in chunk and module by @SyMind in https://github.com/web-infra-dev/rspack/pull/14671
- refactor: avoid runtime module iife in rspack mode by @LingyuCoder in https://github.com/web-infra-dev/rspack/pull/14700
- refactor: colocate rspack runtime lexical globals by @LingyuCoder in https://github.com/web-infra-dev/rspack/pull/14703
- refactor: rename empty context helpers by @LingyuCoder in https://github.com/web-infra-dev/rspack/pull/14733
- refactor(cli): use @rstackjs/load-config by @chenjiahan in https://github.com/web-infra-dev/rspack/pull/14738
- refactor: use rspack runtime identifiers by @LingyuCoder in https://github.com/web-infra-dev/rspack/pull/14739
- refactor: unify runtime globals render modes by @LingyuCoder in https://github.com/web-infra-dev/rspack/pull/14762
Other Changes
- chore(ci): surface Windows Defender status after disable attempt by @stormslowly in https://github.com/web-infra-dev/rspack/pull/14711
- chore(ci): read binary-size data via authenticated API by @stormslowly in https://github.com/web-infra-dev/rspack/pull/14730
- chore(deps): update patch npm dependencies by @renovate[bot] in https://github.com/web-infra-dev/rspack/pull/14751
- chore(deps): update dependency @rslint/core to v0.6.5 by @renovate[bot] in https://github.com/web-infra-dev/rspack/pull/14749
- chore(deps): update dependency @module-federation/runtime-tools to v2.7.0 by @renovate[bot] in https://github.com/web-infra-dev/rspack/pull/14752
- chore(deps): update dependency webpack-sources to v3.5.1 by @renovate[bot] in https://github.com/web-infra-dev/rspack/pull/14750
- revert: "feat: support persistent cache for module hashes" by @ahabhgk in https://github.com/web-infra-dev/rspack/pull/14763
New Contributors
- @Kanary-channelio made their first contribution in https://github.com/web-infra-dev/rspack/pull/14781
Full Changelog: https://github.com/web-infra-dev/rspack/compare/v2.1.3...v2.1.4