v0.17.0
Highlights 💡
Improved ESM output
Optimizing ESM output has long been one of the key challenges faced by Rspack. Previously, we relied on module concatenation to optimize ESM outputs, but that approach had several limitations:
- Impure output – The generated files contained Rspack's runtime code.
- Prone to errors – Some modules could not be correctly concatenated, leading to unexpected runtime issues.
- Limited code-splitting support – Split bundles became complex and difficult to analyze or optimize statically.
To address these issues once and for all, we introduced an experimental plugin called EsmLibraryPlugin, purpose-built for constructing clean and efficient ESM libraries:
- Full control over the bundling process – All modules are linked during compilation, eliminating reliance on Rspack's runtime.
- Code-splitting support – Code after splitting can be statically analyzed and is tree-shaking friendly.
The image below compares the code splitting output before and after using this plugin — the left side shows the previous output, while the right side shows the cleaner output produced by EsmLibraryPlugin:
In Rslib, the EsmLibraryPlugin is now integrated out-of-the-box with experiments.advancedEsm enabled to generate ESM output that is high-quality, more friendly to static analysis, and supports code splitting.
export default {
lib: [
{
format: 'esm',
bundle: true,
experiments: {
advancedEsm: true,
},
},
],
};Tip
Currently this option only takes effect in bundle mode when format is 'esm'.
What's Changed
New Features 🎉
Other Changes
- chore(deps): update all non-major dependencies by @renovate[bot] in #1293
- chore(deps): update dependency nx to v22 by @renovate[bot] in #1294
- ci: add ecosystem CI by @fi3ework in #1296
- ci: add per commit notify by @fi3ework in #1298
- ci: fix yaml file by @fi3ework in #1299
- ci: add main branch to ecosystem-ci by @fi3ework in #1300
- ci: remove useless input by @fi3ework in #1301
- chore(deps): bump Rsbuild 1.6.0 by @Timeless0911 in #1303
- Release v0.17.0 by @Timeless0911 in #1304
New Contributors
Full Changelog: v0.16.1...v0.17.0
