Highlights
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 🎉
Performance 🚀
Bug Fixes 🐞
Refactor 🔨
Other Changes
New Contributors
Full Changelog: https://github.com/web-infra-dev/rspack/compare/v2.1.3...v2.1.4