What's Changed
Highlights 💡
EsmLibraryPlugin supports preserveModules
EsmLibraryPlugin now provides experimental support for the preserveModules feature. This allows you to maintain your source code structure as is while bundling all libraries within the node_modules folder. You can try it out using the following configuration example:
Feel free to copy and use it!
import { rspack } from "@rspack/core";
import path from 'node:path'
export default{
entry: "./index.js",
output: {
chunkFormat: false, // required, EsmLibraryPlugin handles how chunk renders
chunkLoading: 'import', // required, using es module dynamic import syntax to load other chunks
},
optimization: {
runtimeChunk: true, // recommended if you have async chunks
concatenateModules: false, // required, EsmLibraryPlugin handles scope hoisting
},
plugins: [
new rspack.experiments.EsmLibraryPlugin({
preserveModules: path.resolve(__dirname, './src')
})
],
};
Experimental supports for defer import
Rspack now supports defer import, you can enable it by experiments.deferImport = true
. It is worth noting that we currently only support import defer
, import.defer()
will be implemented in the near future.
export default {
experiments: {
deferImport: true
}
}
Performance Improvements ⚡
- perf(cli): switch to cac and refactor code by @chenjiahan in #11893
- perf: replace graceful-fs with node:fs by @chenjiahan in #11894
- perf: remove JS side config validation by @chenjiahan in #11897
- perf(core): adjust default_blocking_threads to 4 in linux with slower fs by @hardfist in #11908
- perf: add support for module.unsafeCache configuration by @SyMind in #11898
- perf: don't drop rust compiler instance in non-watch mode by @hardfist in #11920
- perf: move crypto imports to lazy require calls by @chenjiahan in #11930
- perf: replace node:assert with explicit error checks by @chenjiahan in #11928
- perf(cli): replace colorette with picocolors by @chenjiahan in #11932
- perf: lazy load node:worker_threads to improve startup time by @chenjiahan in #11931
New Features 🎉
- feat(esm): remove empty unneeded runtime chunks by @JSerFeng in #11892
- feat(create-rspack): add type annotations to JS configs by @chenjiahan in #11896
- feat: support defer import by @ahabhgk in #11871
- feat: EsmLibraryPlugin supports preserveModules by @JSerFeng in #11921
Bug Fixes 🐞
- fix: should export from entry chunk for cjs reexport default by @JSerFeng in #11884
- fix: should not cache dependency instance in DynamicEntryPlugin by @SyMind in #11888
- fix: updated dependencies sync to persistent cache by @jerrykingxyz in #11910
- fix: no need to create compiler instance when closing compiler by @chenjiahan in #11923
- fix: should allow override can_inline_use in flag dependency usage plugin by @ahabhgk in #11934
- fix: perf regression caused by is_deferred by @ahabhgk in #11944
Refactor 🔨
- refactor: make artifact collect affected dependencies by @jerrykingxyz in #11905
- refactor: clean up default stats plugins by @chenjiahan in #11904
- refactor: consolidate ModuleError and ModuleWarning classes by @chenjiahan in #11935
Document Updates 📖
- docs(config): optimization.chunkIds update by @vsn4ik in #11900
- docs: add guide for setting thread pool size via environment variable by @chenjiahan in #11912
- docs: fix zh readme miss two line in credits by @WuMingDao in #11917
- docs: sync zh and en readme by @WuMingDao in #11918
Other Changes
- test: use promise instead of done callback by @9aoy in #11872
- chore(deps): update pnpm to v10.18.3 by @renovate[bot] in #11875
- chore: enable some Rslint rules by @chenjiahan in #11869
- chore: release v1.6.0-beta.0 by @JSerFeng in #11830
- chore(deps): update patch npm dependencies by @renovate[bot] in #11874
- chore(deps): update github-actions by @renovate[bot] in #11873
- chore: remove outdated OTP release scripts by @chenjiahan in #11885
- chore(deps): update dependency @playwright/test to v1.56.0 by @renovate[bot] in #11876
- chore: eliminate pnpm install platform warnings by @chenjiahan in #11889
- chore: clean up unused dependencies in test tools package by @chenjiahan in #11886
- chore(deps): update dependency react-refresh to ^0.18.0 by @renovate[bot] in #11810
- test(normalCases): use promise instead of done callback by @9aoy in #11879
- chore(deps): upgrade zod from v3 to v4 and update imports by @chenjiahan in #11883
- chore: Using env to enable sftrace by @quininer in #11880
- test: rewrite hot test cases with NEXT_HMR by @LingyuCoder in #11882
- test: migrate config tests to rstest by @9aoy in #11895
- test: use jsdom runner to run most cases by @LingyuCoder in #11901
- test: Revert 'migrate config tests to rstest (#11895)' by @9aoy in #11902
- test: add warn while closing compiler with failure by @LingyuCoder in #11909
- test: migrate config tests to rstest by @9aoy in #11911
- ci: fix lazy-compilation/persistent-cache ci failed by @jerrykingxyz in #11926
- test: use jsdom runner to run all cases by @LingyuCoder in #11924
- chore: enable Rslint rule: no-empty-interface by @shuga2704 in #11915
- chore: switch to self-hosted macOS runners by @stormslowly in #11925
- chore: fix rustflags not work for dev profile by @quininer in #11936
- test: display error location in jsdom by @LingyuCoder in #11937
- chore(deps): update patch npm dependencies by @renovate[bot] in #11957
- chore(deps): update dependency @arco-design/web-react to ^2.66.6 by @renovate[bot] in #11958
- chore(deps): update dependency @module-federation/runtime-tools to v0.21.1 by @renovate[bot] in #11959
- chore(deps): update crates swc_core to v45.0.1 by @chenjiahan in #11951
New Contributors
- @WuMingDao made their first contribution in #11917
- @shuga2704 made their first contribution in #11915
Full Changelog: v1.6.0-beta.0...v1.6.0-beta.1