Releases: web-infra-dev/rspack
v1.6.5
What's Changed
New Features π
- feat: support prefetch and preload in css extract plugin by @LingyuCoder in #12237
- feat: support SRI with
experiments.cssandCssExtractRspackPluginby @LingyuCoder in #12239
Bug Fixes π
- fix: should inject prefetch startup in entry chunk instead of runtime chunk by @LingyuCoder in #12233
- fix: persistent cache watch missing dependencies changes by @jerrykingxyz in #12228
- fix: generate stable extract css runtime by sorting css chunks by @LingyuCoder in #12246
- fix(create-rspack): use current package manager in templates by @chenjiahan in #12248
- fix: inline enum module should populate its collected_typescript_info by @JSerFeng in #12252
- fix: buildDependency resolver add more file extensions by @jerrykingxyz in #12260
- fix: should not panic when SRI options is invalid by @LingyuCoder in #12259
- fix: not try to add integrity to tags with remote url by @LingyuCoder in #12262
- fix(cli):
devServer.hot: falsenot work by @chenjiahan in #12261 - fix: use modern syntax for reexport runtime by @chenjiahan in #12268
- fix: should match protocol-relative url of public path and tag src in SRI plugin by @LingyuCoder in #12265
- fix: track package.json files in node_modules as build dependencies by @jerrykingxyz in #12274
Refactor π¨
- refactor: processing more string concatenation in runtime template part 2 by @LingyuCoder in #12235
- refactor: rename webpack imported vars to rspack format by @chenjiahan in #12245
- refactor: rename webpack external vars to rspack format by @chenjiahan in #12249
- refactor: rename webpack default export var to rspack format by @chenjiahan in #12257
- refactor: rename webpack reexport vars to Rspack format by @chenjiahan in #12263
- refactor: use chunk id as the placeholder when calculating content-hash by @JSerFeng in #12271
- refactor: render runtime globals by runtime template by @LingyuCoder in #12272
Document Updates π
- docs(config): improve
nodeoptions docs by @chenjiahan in #12236
Other Changes
- test:
maxConcurrencyandtestTimeoutshould be configurable via cli options by @9aoy in #12231 - test: should wait until async startup chunk dependencies loaded by @LingyuCoder in #12234
- chore: release v1.6.4 by @SyMind in #12229
- chore: update rspack resolver to v0.6.6 by @stormslowly in #12149
- chore(deps): update patch npm dependencies by @renovate[bot] in #12242
- chore: disable Rslint warnings by @chenjiahan in #12243
- chore: bump rstest to support show slow-running tests by @9aoy in #12247
- chore(deps): update dependency @rslib/core to v0.18.0 by @renovate[bot] in #12269
- chore(deps): update dependency core-js to v3.47.0 by @renovate[bot] in #12270
- chore(deps): bump Rslib 0.18.1 and remove unnecessary build config by @Timeless0911 in #12273
Full Changelog: v1.6.4...v1.6.5
v1.6.4
What's Changed
New Features π
- feat: support arrow function in on_chunks_loaded callback by @chenjiahan in #12193
- feat(rslib): handle hashbang / react directives natively by @fi3ework in #12168
Bug Fixes π
- fix: should transform
output.pathwhile emitting assets by @LingyuCoder in #12181 - fix: should not transform
[name]/[file]in wasm filename template by @LingyuCoder in #12184 - fix: missing type of http proxy middleware options by @LingyuCoder in #12188
- fix: json module size by @LingyuCoder in #12189
- fix: triple with windows-msvc doesn't support -Cforce-unwind-tables=no by @JSerFeng in #12196
- fix: target should use includes windows-msvc instead of startsWith by @JSerFeng in #12198
- fix: should handle loader error with empty stack trace by @SyMind in #12213
- fix: system library name by @LingyuCoder in #12215
- fix: should handle name convention of css compose by @LingyuCoder in #12202
- fix:
swc-loadershould not respect.swcrcby @CPunisher in #12222 - fix(types): use namespace imports for Node.js built-in modules by @SyMind in #12232
Refactor π¨
- refactor: move code splitting cache into artifact by @hardfist in #12164
- refactor: split make phase by @hardfist in #12186
- refactor: split module_graph into ModuleGraphRef and ModuleGraphMut by @hardfist in #12199
- refactor: processing more string concatenation in runtime template part 1 by @LingyuCoder in #12225
Document Updates π
- docs: upgrade to Rspress V2 new UI by @SoonIter in #12201
- docs: improve section headers by @chenjiahan in #12216
- docs: update editLink config by @SoonIter in #12220
- docs: remove HomeBackground and navTransparent hack by @SoonIter in #12224
- docs(config): improve module.defaultRules documentation by @chenjiahan in #12230
Other Changes
- chore(release): fix debug package release failure by @stormslowly in #12182
- chore: release v1.6.3 by @chenjiahan in #12180
- chore: bump rust toolchain by @JSerFeng in #12183
- test(native-watcher): init native watcher tests by @h-a-n-a in #12185
- chore(ci): support force use github artifacts by @stormslowly in #12187
- test: rename test script from 'test:rstest' to 'test:base' by @chenjiahan in #12194
- ci(native-watcher): test multiple platforms by @h-a-n-a in #12197
- chore(deps): update dependency case-police to ~2.1.0 by @renovate[bot] in #12206
- chore(deps): update dependency markdown-to-jsx to v8 by @renovate[bot] in #12208
- chore(deps): update rust crate fast-glob to v1 by @renovate[bot] in #12209
- chore(deps): update dependency emnapi to ^1.7.1 by @renovate[bot] in #12157
- test: test suite name should include base path by @9aoy in #12214
- test: disable iconv-lite decode warning in test tools by @LingyuCoder in #12217
- chore(deps): update rust crate rayon to 1.11.0 by @renovate[bot] in #12129
- chore(deps): update dependency glob to v11.1.0 [security] by @renovate[bot] in #12223
Full Changelog: v1.6.3...v1.6.4
v1.6.3
What's Changed
New Features π
Bug Fixes π
Document Updates π
- docs(split-chunks): update module federation compatibility note by @chenjiahan in #12178
Other Changes
- chore: simplify import comment style in output code by @chenjiahan in #12163
- chore(deps): update dependency @rspack/lite-tapable to v1.1.0 by @renovate[bot] in #12156
- chore(ci): revert cache action version by @stormslowly in #12170
- chore(ci): fix artifacts slow download by @stormslowly in #12171
- test: can not handle
uncaughtExceptioncorrectly by @9aoy in #12179
Full Changelog: v1.6.2...v1.6.3
v1.6.2
What's Changed
Performance Improvements β‘
New Features π
- feat(mf): support manifest by @2heal1 in #11846
- feat: add Tracy profiler support by @hardfist in #12048
- feat(react-refresh-loader): generate more compact runtime code by @chenjiahan in #12160
Bug Fixes π
- fix: should generate correct relative path for context modules in sourcemap by @LingyuCoder in #12078
- fix: render external re-exports by @JSerFeng in #12089
- fix: support
import.meta.urlas the only param ofnew Worker()by @LingyuCoder in #12095 - fix: inject global entry to async entrypoints by @ahabhgk in #12096
- fix(rstest): should only handles JavaScript module by @fi3ework in #12068
- fix: should rename global in node by @LingyuCoder in #12102
- fix: should add file dependencies in
loaderContext.resolveby @LingyuCoder in #12107 - fix: inner graph class static block usage by @ahabhgk in #12114
- fix: should not inject CSS prefetch/preload runtime when only prefetch/preload JS chunks by @LingyuCoder in #12112
- fix: keep entry chunk signature by @JSerFeng in #12133
- fix: use real resource when exporting from external by @JSerFeng in #12136
- fix: loader order of nested rules by @nilptr in #12132
- fix: mf container entry use startup to load initial chunks by @ahabhgk in #12142
- fix: should not panic if ref-cjs is removed by @JSerFeng in #12147
- fix: should export external aliased right by @JSerFeng in #12143
- fix: should have JS entry for importModule assets and rslib by @JSerFeng in #12167
Refactor π¨
- refactor: remove support for nested importModule usage by @jerrykingxyz in #12111
- refactor: render runtime globals with runtime template by @LingyuCoder in #12144
- refactor: rename some classes and static variables by @LingyuCoder in #12145
- refactor: move compilation.rs to the compilation folder by @hardfist in #12159
- refactor: move build_chunk_graph into compilation by @hardfist in #12162
Other Changes
- test: custom resource loader of test cases by @LingyuCoder in #12091
- chore(deps): update dependency lint-staged to v16 by @renovate[bot] in #12098
- chore(deps): update github-actions (major) by @renovate[bot] in #12099
- chore(deps): update rust crate swc_core to 46.0.3 by @renovate[bot] in #12085
- test: enable more watch cases by @LingyuCoder in #12106
- chore: remove webpackBootstrap comment from output by @chenjiahan in #12108
- chore: remove divider comment from output by @chenjiahan in #12109
- chore(deps): update dependency terser to v5.44.1 by @renovate[bot] in #12117
- chore(deps): update dependency cspell to ^9.3.0 by @renovate[bot] in #12115
- chore(deps): update dependency prebundle to ^1.5.0 by @renovate[bot] in #12116
- chore(deps): update dependency @shikijs/transformers to ^3.15.0 by @renovate[bot] in #12119
- chore(deps): update dependency axios to ^1.13.2 by @renovate[bot] in #12120
- chore(deps): update pnpm to v10.20.0 by @renovate[bot] in #12118
- chore(deps): update dependency @microsoft/api-extractor to v7.54.0 by @renovate[bot] in #12088
- chore(deps): update rust crate tokio to 1.48.0 by @renovate[bot] in #12123
- chore(deps): update rust crate regex to 1.12.2 by @renovate[bot] in #12122
- chore(deps): update rust crate notify to 8.2.0 by @renovate[bot] in #12121
- docs: document global entry behavior in EntryPlugin by @Copilot in #12105
- chore(deps): update rust crate either to 1.15.0 by @renovate[bot] in #12128
- chore(deps): update rust crate camino to 1.2.1 by @renovate[bot] in #12127
- test: migrate rspack wasm test to rstest by @CPunisher in #11990
- test: rename
toMatchFileSnapshottotoMatchFileSnapshotSyncby @9aoy in #12139 - test: remove jest script by @9aoy in #12150
- chore(deps): update dependency iconv-lite to ^0.7.0 by @renovate[bot] in #12158
- chore(deps): update patch npm dependencies by @renovate[bot] in #12153
- chore: deprecate experiments.parallelCodeSplitting by @JSerFeng in #12169
- revert: refactor: remove support for nested importModule usage (#12111) by @jerrykingxyz in #12165
Full Changelog: v1.6.1...v1.6.2
v1.6.1
What's Changed
Highlights π‘
In Rspack 1.6.1, the source map implementation in the rspack-sources crate has been optimized, improving source map generation performance by roughly 30%.
Performance Improvements β‘
Bug Fixes π
- fix: use match resource first when generating css local ident name by @LingyuCoder in #12040
- fix: should export named webpack_require from runtime chunk by @LingyuCoder in #12045
- fix: should increase the counter of sized in mangle exports plugin by @LingyuCoder in #12044
- fix: compatibility
__non_webpack_require__with es modules by @LingyuCoder in #12052 - fix: get chunk filename with dependOn by @LingyuCoder in #12053
- fix: remove redundant
OutputFileSystem.createReadStreamby @colinaaa in #12059 - fix(config): validate
output.pathmust be absolute by @chenjiahan in #12061 - fix: should disable default splitChunks rules for EsmLibraryPlugin by @JSerFeng in #12047
- fix: should handle require ensure with error function by @LingyuCoder in #12054
- fix: should parse webpackExports with empty array by @LingyuCoder in #12066
- fix: use correct Cell for EsmLibraryPlugin by @JSerFeng in #12067
- fix: properties of build meta should be optional when sending to dll plugin from javascript by @LingyuCoder in #12070
- fix: treat HMR's
warnUnexpectedRequireas undefined module factory by @stormslowly in #12016 - fix: defer import and dynamic exportsType default export mixed by @ahabhgk in #12082
- fix:
new URL("", import.meta.url)should be pure by @LingyuCoder in #12076
Refactor π¨
Document Updates π
- docs: add 1.6.0 release blog by @JSerFeng in #12019
- docs: improve English clarity in documentation by @Copilot in #12060
- docs: move deprecated experimental options to the bottom by @chenjiahan in #12049
- docs(quick-start): update non-interactive mode section by @chenjiahan in #12083
Other Changes
- chore: release 1.6.0 by @JSerFeng in #12042
- chore(deps): update dependency core-js to v3.46.0 by @renovate[bot] in #12057
- chore(deps): update dependency @rslib/core to v0.17.0 by @renovate[bot] in #12056
- chore(deps): update dependency @biomejs/biome to ^2.3.2 by @renovate[bot] in #12055
- chore(renovate): disable lockFileMaintenance by @chenjiahan in #12063
- chore: improve struct type and remove some useless fields by @JSerFeng in #12071
- chore: ensure that prettier can format all markdown and JSON files by @chenjiahan in #12075
- chore(deps): update dependency @babel/preset-react to ^7.28.5 by @renovate[bot] in #12087
- chore(deps): update patch npm dependencies by @renovate[bot] in #12084
Full Changelog: v1.6.0...v1.6.1
v1.6.0
π See Announcing Rspack 1.6 for more details.
What's Changed
Performance Improvements β‘
- perf(browser): minor performance optimization for @rspack/browser by @CPunisher in #11795
- perf(swc_plugin_import): replace handlebars with custom template engine by @chenjiahan in #11852
- 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
- perf(cli): simplify ESM file detection by @chenjiahan in #11946
- perf: use ustr for resource_identifier to avoid multiple copies by dependencies by @JSerFeng in #12036
New Features π
- feat(mf): runtimePlugins support pass params by @2heal1 in #11818
- feat(browser): support
modulesinBrowserRequirePluginby @CPunisher in #11822 - feat(mf): support lazy compilation by @2heal1 in #11779
- feat: enable lazy barrel by default by @ahabhgk in #11841
- feat: rslib supports add shims for js/esm by @JSerFeng in #11840
- feat: eval simple expression for enum member by @ahabhgk in #11859
- feat: implement
extractSourceMapoption by @colinaaa in #11814 - 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
- feat: introduce allocative by @quininer in #11927
- feat(browser): re-export
memfsby @CPunisher in #11942 - feat: handle renamed webpack_require by compatibility plugin by @JSerFeng in #11975
- feat(browser): support CORS worker and custom wasm url by @CPunisher in #11996
- feat(create-rspack): add AGENTS.md by @chenjiahan in #12002
- feat: if no commonjs specific syntax detected, treat module as esm by @JSerFeng in #12008
- feat: support ignoreList option in SourceMapDevToolPlugin by @SyMind in #12029
- feat: EsmLibraryPlugin can override invalid user config by @JSerFeng in #12028
Bug Fixes π
- fix(loader-runner): add missing break statements in switch cases by @chenjiahan in #11794
- fix: revert "fix: remove
serdefeature oflightningcss(#11706)" by @colinaaa in #11796 - fix: correct
stats.colortype to include fine-grained options by @chenjiahan in #11797 - fix: export interop default symbol and ensure import required chunks by @JSerFeng in #11793
- fix: should re-export real exportInfo when export dynamic js by @JSerFeng in #11776
- fix: should process runtime chunk after normal chunks of same chunk group by @LingyuCoder in #11778
- fix: should use external source as name hint by @JSerFeng in #11825
- fix(swc_plugin_import): fix panic and optimize diagnostic logs by @chenjiahan in #11862
- fix: distinguish external modules when there are import attributes by @fi3ework in #11845
- fix: should render default exports for cjs entry and json entry by @JSerFeng in #11860
- 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
- fix(create-rspack): polish README and configurations by @chenjiahan in #11953
- fix(mf): federation modules plugin hooks leak by @quininer in #11929
- fix(swcLoader): should correctly generate the default value of env_na⦠by @Zeahan in #11906
- fix(types): add createReadStream to OutputFileSystem interface by @chenjiahan in #11963
- fix: improve type safety for MultiStats options by @chenjiahan in #11964
- fix: should support entries() for compilation.chunks by @SyMind in #11971
- fix: esm output chunk module missing load dependent chunks by @stormslowly in #11945
- fix: inline value for multiple runtime by @ahabhgk in #11983
- fix: unknown defined properties for exported enum by @ahabhgk in #11992
- fix: compilation.*_dep.added should not contains updated files by @jerrykingxyz in #11991
- fix: side effects optimize panic when remove lib file by @jerrykingxyz in #11939
- fix: should only top-level require wrapped modules for import side-effect specifier by @JSerFeng in #11997
- fix: use asset resource module as entry by @LingyuCoder in #11993
- fix: Remove some unnecessary unsafe by @quininer in #12006
- fix: type definitions for devtool module filename templates by @chenjiahan in #12013
- fix: incremental wrong provided exports results caused panic when delete module by @ahabhgk in #12009
- fix: rayon iterator.consume will block in WASM by @jerrykingxyz in #12022
- fix: calculate side effects of call exprs in seq expr by @LingyuCoder in #12017
- fix: should remove related correctly in compilation.updateAsset by @LingyuCoder in #12031
- fix: should resplace resource query in context replacement plugin by @LingyuCoder in #12033
- fix(wasm): add another SharedArrayBuffer instance check by @CPunisher in #12037
Refactor π¨
- refactor: update type definitions to fix Rslint issues by @chenjiahan in #11798
- refactor: remove experiments.layers by @JSerFeng in #11819
- refactor: output.charset false by default by @JSerFeng in #11837
- 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
- refactor(watcher): split watcher from
rspack_fsby @h-a-n-a in #11948 - refactor(core): Convert BoxModule from type alias to newtype struct by @kdy1 in http...
v1.6.0-beta.1
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
v1.6.0-beta.0
π§ͺ Enhanced ESM library output (experimental)
Rspack now provides a new ESM library output that is cleaner, statically analyzable, and supports custom chunk splitting.
This new output format is fully independent of the existing chunk loading logic β each chunk can be used in isolation, and all exports are placed at the top level instead of being wrapped inside the __webpack_modules__ closure.
- Before:
exports.modules = {
"src/async-module.js": function(exports) {
__webpack_require__.d(exports, {
foo: () => foo
})
const foo = 42
}
}- After:
// src/async-module.js
const foo = 42
export { foo }If you'd like to try this now, follow this example:
import { rspack } from "@rspack/core";
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()],
};We'll make this out-of-box in Rslib soon.
See EsmLibraryPlugin for more.
π― Layers is now stable
The layer feature is now enabled by default - you no longer need to enable it manually using the experiments.layer option.
Layers is a feature that helps you group certain modules and their dependencies, allowing you to bundle them using different transforms.
For example, you can generate both ES5 and ES2015 outputs in one compilation by assigning different layers to different entries with the following configuration:
export default {
entry: {
legacy: {
import: "./index.js",
layer: "es5",
},
modern: {
import: "./index.js",
layer: "es6",
},
},
module: {
rules: [
{
test: /\.js$/,
oneOf: [
{
issuerLayer: "es5",
use: [
{
loader: "builtin:swc-loader",
options: {
jsc: {
target: "es5",
// ...
},
},
},
],
},
{
issuerLayer: "es6",
use: [
{
loader: "builtin:swc-loader",
options: {
jsc: {
target: "es2015",
// ...
},
},
},
]
},
],
},
],
},
};π Extract existing source maps
Rspack now supports extracting existing source map data from files (from their //# sourceMappingURL comment) via Rule.extractSourceMap. This feature is particularly useful for preserving source maps provided by third-party libraries, ensuring that debugging information remains accurate even when those libraries are bundled or transformed.
It was originally introduced in webpack v5.102.0
as a built-in replacement for the source-map-loader plugin, offering better performance and tighter integration with the build process.
export default {
// ...
module: {
rules: [
{
test: /\.m?js$/,
extractSourceMap: true,
},
],
},
};β Lazy barrel enabled by default
Since Rspack v1.5 introduced experimental barrel file optimization, it has been enabled by default in Rsbuild to collect early feedback.
After extensive usage and validation within Rsbuild, we now consider lazyBarrel stable, and it is enabled by default in Rspack as well.
What's Changed
Performance Improvements β‘
- perf(browser): minor performance optimization for @rspack/browser by @CPunisher in #11795
- perf(swc_plugin_import): replace handlebars with custom template engine by @chenjiahan in #11852
New Features π
- feat(mf): runtimePlugins support pass params by @2heal1 in #11818
- feat(browser): support
modulesinBrowserRequirePluginby @CPunisher in #11822 - feat(mf): support lazy compilation by @2heal1 in #11779
- feat: enable lazy barrel by default by @ahabhgk in #11841
- feat: rslib supports add shims for js/esm by @JSerFeng in #11840
- feat: eval simple expression for enum member by @ahabhgk in #11859
- feat: implement
extractSourceMapoption by @colinaaa in #11814
Bug Fixes π
- fix(loader-runner): add missing break statements in switch cases by @chenjiahan in #11794
- fix: revert "fix: remove
serdefeature oflightningcss(#11706)" by @colinaaa in #11796 - fix: correct
stats.colortype to include fine-grained options by @chenjiahan in #11797 - fix: export interop default symbol and ensure import required chunks by @JSerFeng in #11793
- fix: should re-export real exportInfo when export dynamic js by @JSerFeng in #11776
- fix: should process runtime chunk after normal chunks of same chunk group by @LingyuCoder in #11778
- fix: should use external source as name hint by @JSerFeng in #11825
- fix(swc_plugin_import): fix panic and optimize diagnostic logs by @chenjiahan in #11862
- fix: distinguish external modules when there are import attributes by @fi3ework in #11845
- fix: should render default exports for cjs entry and json entry by @JSerFeng in #11860
Refactor π¨
- refactor: update type definitions to fix Rslint issues by @chenjiahan in #11798
- refactor: remove experiments.layers by @JSerFeng in #11819
- refactor: output.charset false by default by @JSerFeng in #11837
Document Updates π
- docs: improve documentation for stats properties by @chenjiahan in #11792
- docs: explain how
resolve.aliasaffects package resolution by @SyMind in #11799 - docs(browser): add usage of
useInputFileSystemto "In-Memory File system" section by @CPunisher in #11833 - docs(browser): Add compatibility with
resolve.aliasdescription for BrowserHttpImportEsmPlugin by @CPunisher in #11838
Other Changes
- test: run webpack multi compiler test cases with test tools by @LingyuCoder in #11787
- test: fix hot update loader by @LingyuCoder in #11774
- chore: rspack_plugin_esm_library should have description by @SyMind in #11789
- chore: upgrade mf runtime tools to v0.19.1 by @ahabhgk in #11788
- test: run webpack stats cases with test tools by @LingyuCoder in #11791
- chore(deps): update dependency @rslib/core to v0.15.0 by @renovate[bot] in #11748
- chore(deps): lock file maintenance by @renovate[bot] in #11783
- chore(deps): update dependency typescript to ^5.9.3 by @renovate[bot] in #11802
- chore(deps): update patch npm dependencies by @renovate[bot] in #11801
- chore(deps): update dependency memfs to v4.48.1 by @renovate[bot] in #11807
- chore(deps): update dependency zx to v8.8.4 by @renovate[bot] in #11811
- test: run webpack example cases with test tools by @LingyuCoder in #11820
- test: run webpack watch cases with test tools by @LingyuCoder in #11821
- chore(deps): update dependency @microsoft/api-extractor-model to v7.31.1 by @renovate[bot] in #11816
- chore(deps): update pnpm to v10.18.1 by @renovate[bot] in #11812
- test: skip flaky test cases by @stormslowly in #11827
- test: run webpack hot cases with test tools by @LingyuCoder in #11826
- test: add type of test config files by @LingyuCoder in https://github.com/web-infra-...
v1.5.8
Highlights π‘
Enhanced Tree Shaking for Nested Exports in Destructuring
Rspack now supports more precise tree shaking for nested exports accessed through destructuring assignments.
// lib.js
export * as a from "./a";
export * as b from "./b";
// index.js
import * as lib from "./lib";
// Before: All exports under `lib.a` were retained, only `lib.b` was tree-shaken
// Now: Only the specific property `inner` from `lib.a` is kept; everything else is removed
const { a: { inner } } = lib;What's Changed
Performance Improvements β‘
- perf: rspack sources buffer function by @SyMind in #11749
- perf: avoid unnecessary source map creation by @CPunisher in #11773
New Features π
- feat: should retain source error name by @SyMind in #11762
- feat(parser): add
commonjsoptions by @fi3ework in #11744 - feat: transform url in new URL without runtime by @JSerFeng in #11765
- feat: add experimental EsmLibraryPlugin for better esm output by @JSerFeng in #10350
- feat: tree shaking nested exports for destructuring assignment by @ahabhgk in #11781
Bug Fixes π
- fix: cjs export require tree shaking by @ahabhgk in #11758
- fix: should always walk import then arguments by @ahabhgk in #11760
- fix: should update alias resolution when a higher-priority file is created in watch mode by @SyMind in #11643
- fix: should analyze correct variable for dynamic import by @ahabhgk in #11768
- fix: URLPlugin in child compiler by @SyMind in #11785
Refactor π¨
- refactor: remove unused parameters and clean up code by @chenjiahan in #11756
- refactor: file counter save the resource id which used the file by @jerrykingxyz in #11757
Document Updates π
- docs: add commonjsMagicComments docs by @stormslowly in #11752
- docs: document parser jsx option by @fi3ework in #11767
- docs: add Snap to who is using section by @chenjiahan in #11777
- docs(style): remove unexpected borders on code block focus by @ritoban23 in #11784
Other Changes
- test: remove simple tester by @LingyuCoder in #11751
- chore(deps): update dependency memfs to v4.46.0 by @renovate[bot] in #11721
- test: close compiler by @LingyuCoder in #11764
- chore(deps): lock file maintenance by @renovate[bot] in #11726
- test: add persistent cache symlink test case by @jerrykingxyz in #11769
- chore(deps): update swc by @renovate[bot] in #11747
New Contributors
- @ritoban23 made their first contribution in #11784
Full Changelog: v1.5.7...v1.5.8
v1.5.7
Highlights π‘
Improved Tree Shaking for Dynamic Import .then()
This release enhances tree shaking capabilities specifically for the .then() callbacks of dynamic imports. Rspack can now statically analyze and eliminate unused exports when destructuring is performed on the resolved module within promise chains:
// Tree shaking now works for destructuring in .then() callbacks
import('./utils').then(module => {
const { usedFunction } = module; // Only usedFunction will be included
usedFunction();
// unusedFunction will be tree-shaken out
});JSX Preserve Support
Rspack now supports parsing and preserving JSX syntax. This allows JSX syntax to be parsed without transformation, making it compatible with external JSX transformers.
// rspack.config.js
export default {
module: {
parser: {
javascript: {
jsx: true // Enable JSX parsing
}
},
rules: [
{
test: /\.jsx?$/,
use: {
loader: 'swc-loader',
options: {
jsc: {
parser: { jsx: true },
transform: {
// Preserve JSX syntax
react: { runtime: 'preserve' }
}
}
}
}
}
]
}
};What's Changed
New Features π
- feat: static analyze destructuring assignment dynamic import variable for tree shaking by @ahabhgk in #11731
- feat: parser support jsx by @fi3ework in #11664
Bug Fixes π
- fix: correct infrastructureLog type and add documentation by @chenjiahan in #11742
- fix: inline enum not only properties used by @ahabhgk in #11740
- fix: mf should correctly hoist modules by @ahabhgk in #11743
Document Updates π
- docs: improve Web Workers documentation with more details by @chenjiahan in #11737
Other Changes
- test: refactor processor by @LingyuCoder in #11732
- test: rename config files by @LingyuCoder in #11733
- test: remove processor by @LingyuCoder in #11738
- test: remove runner factory by @LingyuCoder in #11741
- chore(deps): update github-actions by @renovate[bot] in #11746
- chore(deps): update patch npm dependencies by @renovate[bot] in #11680
Full Changelog: v1.5.6...v1.5.7