Releases: web-infra-dev/rspack
v0.5.4
What's Changed
Highlight
- Support alias require:
// commonjs file
const alias = require
alias('./foo') // now `foo.js` will be bundled
Performance Improvements ⚡
Exciting New Features 🎉
- feat: support alias require by @bvanjoi in #5520
- feat(rspack_core): use consistent fxhash for ustr instead of inconsistent ahash by @Boshen in #5504
- feat(rspack): align default resolveOptions with webpack by @Boshen in #5540
- feat: concatenation module part two by @IWANABETHATGUY in #5415
- feat: support custom source root by @SyMind in #5522
- feat(devtool): add "eval" support by @xc2 in #5495
- feat: deprecate
compiler.rebuild
by @h-a-n-a in #5583
Bug Fixes 🐞
- fix: not parse require in esm by @bvanjoi in #5515
- fix: test jobs should not run in forked repositories by @SyMind in #5499
- fix: module not exist in context modules by @h-a-n-a in #5534
- fix: fix test for consistent splitChunk by @JSerFeng in #5539
- fix: wrongly generated alternative requests in context modules by @h-a-n-a in #5538
- fix: should split chunks size larger than maxSize by @JSerFeng in #5562
- fix: 🐛 call finish module in rebuild_module instead of update_module_graph by @IWANABETHATGUY in #5559
- fix: exec
per_statement
parser hooks by @bvanjoi in #5568 - fix: json parse error by @h-a-n-a in #5565
- fix(cli): fix cts support by @hardfist in #5575
- fix: zod.devtool - missing inline-nosources-cheap-source-map by @xc2 in #5478
- fix: source root error in windows by @SyMind in #5581
- fix: 🐛 inner graph extend class super with constructor by @IWANABETHATGUY in #5552
- fix: buildinfo cacheable default value should be true by @jerrykingxyz in #5603
- fix: missing visitor in concatenate modules by @IWANABETHATGUY in #5591
- fix: codegen cache should consider runtime by @JSerFeng in #5605
- fix: should gracefully shutdown on bail by @h-a-n-a in #5610
Other Changes
- typo: Update index.ts by @cunzaizhuyi in #5511
- refactor: cleanup
HarmonyDetectionScanner
by @bvanjoi in #5508 - refactor: cleanup
WorkerSyntaxScanner
in deps collection stage by @bvanjoi in #5512 - ci: change renovate bot to run only once per week by @Boshen in #5514
- refactor: cleanup
WorkerSyntaxScanner
in optimize by @bvanjoi in #5513 - ci: enable swc for renovate bot by @Boshen in #5517
- chore: add tests for consistent splitChunks output by @JSerFeng in #5510
- chore: use the same postcss version for this monorepo by @Boshen in #5518
- chore: remove ci pull_request branches-ignore by @jerrykingxyz in #5529
- refactor: cleanup
WorkerScanner
by @bvanjoi in #5527 - chore: 🤖 remove tree shaking diff by @IWANABETHATGUY in #5530
- revert: revert tests for consistent splitChunks output by @JSerFeng in #5537
- refactor: align external module and static exports dependency with webpack by @LingyuCoder in #5542
- chore(deps): update swc by @renovate in #5519
- chore: remove "Test Plan" from pull request template by @Boshen in #5541
- chore: update issue template with title prefix by @hardfist in #5553
- refactor: move chunk_group_info to code splitting by @JSerFeng in #5549
- chore: rename split_chunks_new to split_chunks by @JSerFeng in #5555
- chore(deps): update crates by @renovate in #5523
- refactor: add
ImportMetaContextDependencyParserPlugin
by @bvanjoi in #5557 - chore: align more tests by @h-a-n-a in #5558
- ci: don't cancel jobs on main by @Boshen in #5563
- revert: feat: support custom source root (#5522) by @SyMind in #5561
- refactor: immutable module graph during code generation by @LingyuCoder in #5543
- chore: more total cases by @h-a-n-a in #5569
- refactor: initialize stage hook for
hooks.compilation
by @ahabhgk in #5532 - chore: avoid const enum in node binding dts by @ahabhgk in #5584
- refactor: cleanup
HotModuleReplacementScanner
by @bvanjoi in #5585 - refactor: cleanup some expr_match in parser by @bvanjoi in #5589
- chore: align more hotcases by @h-a-n-a in #5566
- chore: 🤖 add comments when the export name is unused by @IWANABETHATGUY in #5598
- chore: align the rest of diffing cases by @h-a-n-a in #5599
- chore: run diff on linux only by @h-a-n-a in #5602
- refactor: on demand apply
hooks.compilation
js hook by @ahabhgk in #5586 - refactor: cleanup
ImportScanner
by @bvanjoi in #5607 - test: add test case for eager import by @bvanjoi in #5608
- chore: remove wrapped module identifier by @IWANABETHATGUY in #5609
- refactor: cleanup
ImportMetaScanner
by @bvanjoi in #5547
Full Changelog: v0.5.3...v0.5.4
v0.5.3
What's Changed
Highlights
Fix: build gets stuck at seal when using Module Federation with shared
option
When using ModuleFederationPlugin with shared
option, build may get stuck. See #5494
Performance Improvements ⚡
- perf: lazy calculate compilation.modules and compilation.chunks by @jerrykingxyz in #5433
- perf: lazy calculate asset.source by @jerrykingxyz in #5483
- perf: set default WATCHPACK_WATCHER_LIMIT to 20 by @hardfist in #5486
- perf: enable "thin" LTO for release by @Boshen in #5505
Exciting New Features 🎉
Bug Fixes 🐞
- fix: evaluate if stmt should skip import specifier in dead branch by @JSerFeng in #5431
- fix: resolve error with inline loader without module specifier by @SyMind in #5409
- fix(@rspack/core): js Compilation instance is not recreated as expected when rebuilding on watch/serve mode by @xc2 in #5436
- fix(renovate): ignore
textwrap
by @Boshen in #5444 - fix: InnerGraph does not rename the usage of the renamed class in if statement #5441 by @IWANABETHATGUY in #5448
- fix: use full content hash in
SourceMapDevtoolPlugin
by @SyMind in #5447 - fix: assign depth for include dependencies by @ahabhgk in #5458
- fix: fix oxlint warning and trigger js when pnpm changes by @Boshen in #5484
- fix: make split consistant result by @JSerFeng in #5488
- fix: should not provide for defined variable by @ahabhgk in #5489
- fix: asset source can not be undefined by @jerrykingxyz in #5509
Other Changes
- cleanup
CompatibilityScanner
by @bvanjoi in #5422 - refactor: cleanup unnecessary swc visitor by @bvanjoi in #5432
- chore: use
cargo machete
for checking unused dependencies by @Boshen in #5429 - chore: fix broken build by @Boshen in #5440
- refactor: streamline filename creation and context preparation for assets in SourceMapDevToolPlugin by @SyMind in #5434
- chore: unify crate versions by @Boshen in #5449
- chore: pin
styled_components
along with the same swc versions by @Boshen in #5451 - chore(deps): update crates by @renovate in #5425
- chore(deps): update rust crate wasmparser to 0.120.0 by @renovate in #5455
- Cleanup some scanner by @bvanjoi in #5452
- refactor: cleanup swc react visitor by @bvanjoi in #5457
- chore: bump indexmap from 1.9.3 to 2.1.0 by @Boshen in #5459
- chore: bump bitflags to v2.4.2 by @Boshen in #5462
- chore: renovate bot turn on npm devDependencies update by @Boshen in #5464
- chore: renovate ignore more directories by @Boshen in #5466
- chore: bump handlebars to v5.1.1 by @Boshen in #5463
- chore: bump TypeScript to 5.3.3 by @Boshen in #5468
- chore: remove typescript devDependencies from packages/create-rspack/template-react-ts by @Boshen in #5470
- refactor: reimplement queue handler by @JSerFeng in #5435
- chore: bump @types/react and @types/react-dom by @Boshen in #5471
- chore(renovate): ignore @playwrite/test by @Boshen in #5473
- chore: ignore react upgrades by @Boshen in #5474
- chore(deps): update npm devdependencies by @renovate in #5467
- chore(deps): update pnpm to v8.14.3 by @renovate in #5465
- refactor: cleanup
CommonJsScanner
by @bvanjoi in #5482 - chore: enable newTreeshaking on arco-pro diff case by @LingyuCoder in #5381
- refactor: cleanup
CommonJsExportsParserPlugin
by @bvanjoi in #5487 - refactor: cleanup
NodeStuffScanner
by @bvanjoi in #5493 - chore: revert TypeScript to v5.0.2 due to broken "NodeNext" for compilerOptions.module by @Boshen in #5503
- refactor: align HarmonyCompatibiltyDependency with webpack by @LingyuCoder in #5472
Full Changelog: v0.5.2...v0.5.3
v0.5.2
What's Changed
Highlights
Support SourceMapDevToolPlugin
Support SourceMapDevToolPlugin
. With this enhancement, options such as output.devtoolModuleFilenameTemplate
, output.devtoolFallbackModuleFilenameTemplate
, and output.devtoolNamespace
are now fully supported.
Based on the devtoolModuleFilenameTemplate
option, you can follow this example to debug a webpack project in VS Code.
Performance Improvements ⚡
- perf: use hashset to compare ignore by @bvanjoi in #5366
- perf: reduce alloc by @bvanjoi in #5386
- perf: cleanup
ApiScanner
by @bvanjoi in #5390
Exciting New Features 🎉
- feat(runtime): add rspack version by @LingyuCoder in #5310
- feat(cli): support built-in rspack envs by @xc2 in #5272
- feat(compilation): introduce queue handles representing task_queue by @JSerFeng in #4785
- feat: improve SourceMapDevToolPlugin by @SyMind in #5108
- feat: not printing error code in error by @h-a-n-a in #5363
- feat: export hot entry from
@rspack/core
by @ahabhgk in #5362 - feat: handle webpack internal module source map by @SyMind in #5371
- feat: support compilation.hooks.runtimeModule by @LingyuCoder in #5370
- feat: concatenate plugin part one by @IWANABETHATGUY in #5237
- feat: progress plugin by @faga295 in #5008
- feat(compilation): add ImportModule and executeModule by @JSerFeng in #4718
Bug Fixes 🐞
- fix(parser): reserved binding name in strict mode by @LingyuCoder in #5319
- fix: stable version snapshot by @LingyuCoder in #5346
- fix: tree shaking size differentiation between webpack by @IWANABETHATGUY in #5349
- fix(asset): real content hash changed even if asset has not changed by @LingyuCoder in #5359
- fix: return type of
Compiler.shouldEmit
should be boolean by @Amour1688 in #5378 - fix(mf): different fallback module context by @ahabhgk in #5380
- fix(rspack_core): fix resolver returning broken missing dependencies by @Boshen in #5357
- fix: remove unnecessary return type of runtime module hook by @LingyuCoder in #5389
- fix: url-dependency pos error by @JSerFeng in #5397
- fix: remove unnecessary react-refresh from dev-server's dependencies by @LingyuCoder in #5404
- fix(renovate): fix cargo by @Boshen in #5413
- fix: use correct stats for child compilation by @ahabhgk in #5405
- fix(renovate): improve handling of certain packages by @Boshen in #5414
- fix: use
eval.as_string()
lazily by @bvanjoi in #5427 - fix: cannot block the current thread from within a runtime by @SyMind in #5428
Other Changes
- refactor: traceable magic comments warnings by @LingyuCoder in #5341
- refactor: traceable non supported warnings by @LingyuCoder in #5342
- chore: bump swc by @JSerFeng in #5308
- chore: remove a console.log from rspack tests that fills the screen by @Boshen in #5345
- refactor: cleanup common_js_import_dependency_scanner by @bvanjoi in #5347
- test: enable some diff test case by @bvanjoi in #5348
- refactor: traceable harmony scanner errors by @LingyuCoder in #5344
- refactor: align HarmonyExportHeaderDependency by @LingyuCoder in #5351
- chore: remove sinon from webpack-test by @Boshen in #5350
- refactor: remove load chunk with block runtime by @ahabhgk in #5335
- chore: remove unused puppeteer by @Boshen in #5353
- chore(diff): esm module by @LingyuCoder in #5290
- refactor: cleanup url_scanner by @bvanjoi in #5354
- refactor(compilation): Add callback to factorizeTask and make process dependencies happen after all dependencies get factorized by @JSerFeng in #4835
- refactor: remove async dependencies block identifier by @ahabhgk in #5356
- test: remove outdated tests by @h-a-n-a in #5355
- chore(diff): add esm export case by @LingyuCoder in #5300
- chore(diff): add esm import case by @LingyuCoder in #5302
- chore: remove logs from tests by @h-a-n-a in #5361
- refactor: cleanup ExportsInfoApiScanner by @bvanjoi in #5367
- chore: normalizing jsword by @IWANABETHATGUY in #5369
- chore: remove unused @types/webpack-dev-server from rspack devDependencies by @Boshen in #5333
- chore: remove duplicated test cases (tests/case.test.ts) by @h-a-n-a in #5373
- test(diff): add diff test case for harmony+commonjs mixed modules by @LingyuCoder in #5379
- chore: enable most of the tests from webpack-examples by @Boshen in #5376
- chore: snap.diff changed by @SyMind in #5382
- refactor: cleanup useless ast api by @bvanjoi in #5388
- chore: remove duplicated test cases (tests/configCase.test.ts) by @h-a-n-a in #5374
- chore: diff rspack/webpack test cases by @h-a-n-a in #5391
- chore: triage diff for configcases and cases by @h-a-n-a in #5396
- ci: setup renovatebot by @Boshen in #5406
- ci: only update github-actions and cargo dependencies by @Boshen in #5410
- chore: 🤖 remove redundant config by @IWANABETHATGUY in #5402
- chore(renovate): disable breaking changes upload / download actions by @Boshen in #5421
- chore(deps): update github-actions by @renovate in #5417
- chore(renovate): ignore ustr by @Boshen in #5424
- chore(deps): update github-actions (major) by @renovate in #5423
New Contributors
- @Amour1688 made their first contribution in #5378
- @renovate made their first contribution in #5417
Full Changelog: v0.5.1...v0.5.2
v0.5.1
What's Changed
Highlights
Rspack Examples
Rspack configuration examples are moved to rspack-examples.
This repository contains all rspack, rsbuild and rspress configuration examples. Contributions are welcome for expanding the examples.
Resolve
- Deprecated
resolve.browserField
in favor ofresolve.aliasFields
. - Added
resolve.preferAbsolute
,resolve.restrictions
,resolve.roots
andresolve.aliasFields
options
Better module resolution hints
Exciting New Features 🎉
- feat(swc_plugin_import): support camelCase and snake_case (#5283)
- feat: deprecate resolve.browserField and enable resolve.{preferAbsolute,restrictions,roots,aliasFields} (#5223)
- feat: introduce
JavascriptParser
(#5280) - feat: resolve with hint (#5178)
- feat: support module build error (#5286)
Bug Fixes 🐞
- fix: cjs module reexport unused error (#5291)
- fix: fix cli command alias bug (#5307)
- fix: module graph incorrect when delete or create file (#5301)
- fix: should not assume module directories always exist (#5326)
- fix: unregistered case handler should not panic (#5330)
Performance Improvements ⚡
- perf: lazily init help message (#5309)
Chores
- chore(diff): fix diff detail output (#5299)
- chore: add link to rspack-contrib/rspack-examples in README (#5297)
- chore: bump oxlint to v0.2.0 (#5327)
- chore: nightly release alert when failed (#5323)
- chore: remove examples directory (to github.com/rspack-contrib/rspack-examples) (#5296)
- chore: remove unused Rust dependencies (#5312)
- chore: turn off
--bail
--forceExit
--logHeapUsage
from webpack test (#5303) - chore: upgrade Rust to v1.75.0 (nightly) (#5305)
- chore: use pnpm v8 default flags (#5304)
- test: replace error stack in test (#5325)
v0.5.0
Rspack 0.5.0 is out!
Read the announcement blog post: Announcing Rspack 0.5.
Overview
- Module Federation added to Rspack
- optimization.chunkIds is deterministic in production mode by default
- Remove default transformation
- Remove extended resolve extensions
- Make @swc/helpers and react-refresh as peerDependencies
- Remove deprecated builtins options
What's Changed
Performance Improvements ⚡
- perf: exports info hash by @IWANABETHATGUY in #5125
- perf: delete useless calls by @bvanjoi in #5155
Exciting New Features 🎉
- feat: add diag test by @bvanjoi in #5113
- feat: support CommonJsSelfReferenceDependency by @LingyuCoder in #5114
- feat: removes all deprecate warning in CI by @lippzhang in #5127
- feat: warning of magic comment by @LingyuCoder in #5126
- feat: support DependencyTemplate of CommonJsExportRequireDependency by @LingyuCoder in #5130
- feat: support custom banner by @bvanjoi in #5153
- feat: bump tracing to support
NO_COLOR
by @bvanjoi in #5156 - feat: support module.require by @LingyuCoder in #5167
- feat: support
webpackIgnore
comment by @bvanjoi in #5172 - feat: remove extended resolve extensions by @h-a-n-a in #5184
- feat: remove experiments.incrementalRebuild option by @jerrykingxyz in #5225
- feat: add remoteInitOptions as initContainer params by @ahabhgk in #5247
Bug Fixes 🐞
- fix(rspack-dev-server): remove webpack dep by @hardfist in #5119
- fix(mf): should not have extra empty chunk by @ahabhgk in #5128
- fix: user freindly error msg for output.hashFunction by @bvanjoi in #5129
- fix: library module renderStartup missing export by @bvanjoi in #4901
- fix(plugin-runtime):
stringify_chunk
should escape special chars in chunk names as js's JSON.stringify do by @xc2 in #5117 - fix: entryOptions should able to merge by @ahabhgk in #5134
- fix: should not create additional missing modules by @h-a-n-a in #5124
- fix(treeshaking): calculate add_connection_states right by @JSerFeng in #5140
- fix: sort errors and warnings in stats based on offsets by @h-a-n-a in #5142
- fix: harmony export default from should be a parse error by @h-a-n-a in #5144
- fix: import meta url property by @LingyuCoder in #5145
- fix: enable more mf v1.5 tests by @ahabhgk in #5148
- fix: external modules in esm by @LingyuCoder in #5146
- fix: should store dependencies even if module factorization is failed by @h-a-n-a in #5137
- fix: empty name and complex member expression in cjs dependency by @LingyuCoder in #5154
- fix: missing module in block by @ahabhgk in #5171
- fix(mf1.5): container name in runtime by @ahabhgk in #5175
- fix(mf1.5): add resolve alias for mf runtime by @ahabhgk in #5239
- fix: not enable rspack-plugin-react-refresh when mode set to 'product… by @hardfist in #5260
Other Changes
- refactor: remove
get
andget_mut
inDatabase
by @bvanjoi in #5121 - revert: removes all deprecate warning in CI by github CI by @lippzhang in #5135
- refactor: align render module arguments with webpack by @LingyuCoder in #5131
- refactor: 🤖 avoid clone exports info by @IWANABETHATGUY in #5141
- chore: add module federation example by @ahabhgk in #5136
- chore: add hmr and react refresh for module federation example by @ahabhgk in #5159
- chore: comment benchmark result for commit by @jerrykingxyz in #5170
- chore: build rspack/core first by @jerrykingxyz in #5174
- refactor(rspack_core): remove nodejs_resolver and
experiments.rspackFuture.newResolver
by @Boshen in #5089 - refactor: replace devServer.hot by HotModuleReplacementPlugin by @ahabhgk in #5193
- refactor: enable disableApplyEntryLazily by default by @ahabhgk in #5179
- refactor: remove builtin:sass-loader for 0.5 by @ahabhgk in #5177
- chore: remove deprecated splitChunksPlugin by @JSerFeng in #5208
- refactor: remove deprecated builtins options by @ahabhgk in #5207
- chore: add module federation interop example by @ahabhgk in #5224
- refactor: move swc helpers and react-refresh to peer by @ahabhgk in #5228
- chore: fix template version by @hardfist in #5261
- chore: fixed mf 1.5 runtime version by @ahabhgk in #5275
Full Changelog: v0.4.5...v0.5.0
v0.4.5
Highlights
Support compilation.hooks.afterOptimizeModules
hook
Called after modules optimization has completed.
compilation.hooks.afterOptimizeModules.tap("plugin_name", function(modules) {
// do something
})
Support __webpack_is_included__
Test whether or not the given module is bundled by rspack.
if (__webpack_is_included__('./module-a.js')) {
// do something
}
Support webpackPrefetch
and webpackPreload
When doing dynamic import, it is allowed in the magic comments to tell the browser whether the resource will be used in the future.
import(
/* webpackPrefetch: true */
/* webpackPreload: true */
'module'
);
Support error early bail
Fail out on the first error instead of tolerating it.
// rspack.config.js
module.exports = {
//...
bail: true,
};
What's Changed
Exciting New Features 🎉
- feat: deprecate apply options lazily by @ahabhgk in #5066
- feat: introduce
is_strict
in scanner by @bvanjoi in #5076 - feat: support webpack_is_included by @LingyuCoder in #5087
- feat: integrate mf 1.5 runtime by @ahabhgk in #5063
- feat: eval regexp in require.context by @bvanjoi in #5094
- feat: support error early bail by @h-a-n-a in #5084
- feat: support
hooks.afterOptimizeModules
by @bvanjoi in #5102 - feat: support custom filename for GetChunkFilenameRuntimeModule by @JSerFeng in #5105
- feat(mf): add version check warning for sharing by @ahabhgk in #5116
Bug Fixes 🐞
- fix: try to fix execution context destroy by @h-a-n-a in #5077
- fix: boolean matcher regexp by @LingyuCoder in #5080
- fix: exportImportedspecifier interop by @IWANABETHATGUY in #5083
- fix: OOM when use trace by @jerrykingxyz in #5079
- fix: unnecessary import runtime code from css_loading_with_loading.js by @SyMind in #5055
- fix: pass define plugin to childCompiler by @ahabhgk in #5093
- fix: unique name in load script runtime module by @LingyuCoder in #5098
- fix: asset publicPath in css with rule asset generator by @ahabhgk in #5099
- fix: umd with library.export by @IWANABETHATGUY in #5092
- fix: apply entry lazily warning message by @ahabhgk in #5109
- fix(mf1.5): remoteInfos when moduleIds is not named by @ahabhgk in #5101
Other Changes
- chore: force build JS packages on CI by @h-a-n-a in #5075
- chore: add comparator for diff tester by @LingyuCoder in #5014
- refactor: move most options to builtin plugin by @ahabhgk in #5078
- chore(runtime-diff): require chunk loading runtime module by @LingyuCoder in #4913
- chore(runtime-diff): import scripts chunk loading diff runtime module by @LingyuCoder in #4914
- chore(runtime-diff): read file chunk loading runtime module by @LingyuCoder in #4912
- chore: remove heavy debug node
util.inspect
call by @Boshen in #5029 - chore: fix typos in JavaScript and TypeScript files by @Boshen in #5095
- chore: send notification when main branch ci failed by @jerrykingxyz in #5112
Full Changelog: v0.4.4...v0.4.5
v0.4.4
Highlights
Allow passing function type to splitChunks.cacheGroups
//...
optimization: {
splitChunks: {
chunks: "all",
minSize: 0,
cacheGroups: {
splitLib2: {
chunks(chunk) {
console.log(chunk);
return chunk.name !== "lib1";
},
test: /shared\.js/,
name: "shared",
},
},
},
},
...
It gives you more flexibility to control code splitting behavior
Allow parse js hashbang syntax
Now rspack can process file like
#!/usr/bin/env node
import { foo } from "./lib";
console.log("index", foo);
A bunch of diagnostics improvement
more details you could refer:
What's Changed
Performance Improvements ⚡
Exciting New Features 🎉
- feat: 🎸 json tree shaking by @IWANABETHATGUY in #4858
- feat: add script nonce by @LingyuCoder in #4975
- feat(es): allow parse js hashbang syntax by @magic-akari in #4970
- feat(runtime): support module.parser.url=relative by @LingyuCoder in #4988
- feat(runtime): support webpack_chunkname by @LingyuCoder in #4990
- feat: support webpack_runtime_id by @LingyuCoder in #4993
- feat: stats for childCompiler by @ahabhgk in #5007
- feat: add function type splitChunks chunks by @ahabhgk in #5019
- feat: support rgb colors for ansi-html by @h-a-n-a in #5020
- feat(cli): support to set output.path by @puppet-666 in #4979
- feat: align ExportImportedSpecifierDependency init fragments by @IWANABETHATGUY in #4995
- feat: support eval abstract equal by @bvanjoi in #5037
- feat: isomorphism mf 1.0 and 1.5 by @ahabhgk in #4959
- feat: eval array and regexp in binary expr by @bvanjoi in #5051
- feat(runtime): prefetch&preload by @LingyuCoder in #5031
- feat: support pseudo webpack extension and custom module type by @JSerFeng in #5061
- feat: eval template string in binary expr by @bvanjoi in #5064
- feat: diagnostics in overlay by @h-a-n-a in #5049
- feat: add module parse error by @h-a-n-a in #5062
- feat: eval if-else stmt by @bvanjoi in #5073
Bug Fixes 🐞
- fix: add node modules to npmginore in templates by @burhanuday in #4976
- fix: align mangle exports comments by @IWANABETHATGUY in #4954
- fix(config): support pass false to plugins by @puppet-666 in #4949
- fix(@rspack/core): minify should be disabled when minimizer is an empty array by @xc2 in #4911
- fix: append builtin minify plugin for child compiler by @bvanjoi in #4987
- fix: 🐛 class memeber side effects by @IWANABETHATGUY in #4983
- fix: handle chunk relation by @JSerFeng in #4984
- fix(runtime): globals on require in runtime plugin by @LingyuCoder in #4998
- fix: parse left and right when eval failed for logic expr by @bvanjoi in #5000
- fix: license-webpack-plugin failed to generate license for some of module by @ahabhgk in #5003
- fix: stats childCompiler test by @ahabhgk in #5015
- fix: remove console.log by @LingyuCoder in #5018
- fix: runtime chunk order by @LingyuCoder in #5021
- fix: add "symlinks" option to resolve config validation by @bostondv in #5034
- fix(remove-parent-modules): only filter runtime chunk by @JSerFeng in #5036
- fix: 🐛 fix escape json by @IWANABETHATGUY in #5042
- fix: umd library integrate with newTreeshaking by @IWANABETHATGUY in #5043
- fix: remove available modules from ancestor by @JSerFeng in #4994
- fix: webpack-test/configCases/split-chunks/async-entries by @IWANABETHATGUY in #5050
- fix: extract_block_modules dependencies order by @IWANABETHATGUY in #5046
- fix: `ruleSetLogicalConditions.not should not just array by @bvanjoi in #5059
- fix: hmr css with filename by @ahabhgk in #5069
- fix: serialize path of stats on windows by @h-a-n-a in #5070
Other Changes
- ci: speed up CI by turning off sourcemap for arco-pro by @Boshen in #4985
- chore(runtime-diff): module chunk loading runtime module by @LingyuCoder in #4916
- chore: add comparator for diff tester by @LingyuCoder in #5002
- revert: "chore: add comparator for diff tester" by @LingyuCoder in #5009
- chore: run benchmark on main branch by @jerrykingxyz in #5011
- chore(diff): add more diff cases by @LingyuCoder in #5012
- chore(diff): scan diff cases by glob by @LingyuCoder in #5016
- chore: remove fast querystring just use node module querysting parse by @m1911star in #4749
- chore: update Readme.md by @hardfist in #5023
- refactor: clever merge resolve options by @bvanjoi in #4974
- chore: remove #4325 in webpack-test by @ahabhgk in #5035
- refactor: make sure add all runtime globals when process_runtime_requirements by @ahabhgk in #5032
- chore(runtime-diff): jsonp chunk loading runtime module by @LingyuCoder in #4915
- chore(rspack_core): oxc_resolver v0.6.2 by @Boshen in #5047
- refactor: diagnosable modules by @h-a-n-a in #4924
New Contributors
- @burhanuday made their first contribution in #4976
- @puppet-666 made their first contribution in #4949
- @bostondv made their first contribution in #5034
Full Changelog: v0.4.3...v0.4.4
v0.4.3
Highlights
Support optimization.splitChunks.hidePathInfo
Prevents exposing path info when creating names for parts splitted by maxSize.
Support splitChunks.automaticNameDelimiter
By default rspack will generate names using origin and name of the chunk (e.g. vendors~main.js
). This option lets you specify the delimiter to use for the generated names. doc
Support splitChunks.cacheGroups.{cacheGroup}.filename
Sets the hint for chunk id. It will be added to chunk's filename. doc
What's Changed
Performance Improvements ⚡
Exciting New Features 🎉
- feat: mf fallback module by @ahabhgk in #4895
- feat(rspack/minified): support info.minimized from copy plugin (#4908) by @Kunduin in #4909
- feat: eval binary expression by @bvanjoi in #4918
- feat: support splitChunks.cacheGroup.filename&delimiter by @LingyuCoder in #4930
- feat: runtime optimization by @IWANABETHATGUY in #4917
- feat: support eval
typeof require
by @bvanjoi in #4929 - feat(runtime): optimize get chunk filename runtime module with dynamic+static by @LingyuCoder in #4943
- feat: add create_module_assets by @JSerFeng in #4941
- feat: add more chunk methods by @ahabhgk in #4951
- feat: support optimization.splitChunks.hidePathInfo option by @SyMind in #4964
Bug Fixes 🐞
- fix: module decorator when harmony mixed by @LingyuCoder in #4900
- fix: webpack-test/cases/parsing/issue-7519 with tree shaking enable by @IWANABETHATGUY in #4904
- fix: eco-ci trigger after nightly release by @ahabhgk in #4853
- fix(rspack_core): oxc_resolver v0.6.0 - resolve styled-components correctly by @Boshen in #4928
- fix: inner graph function visit by @IWANABETHATGUY in #4927
- fix: should return number.to_string instead of char::from by @IWANABETHATGUY in #4947
- fix: rm dep type for resolve by @bvanjoi in #4946
- fix: 🐛 align with webpack number_hash by @IWANABETHATGUY in #4955
- fix: module.context is undefined by @SyMind in #4961
- fix: remove static new_treeshaking switch by @JSerFeng in #4962
- fix: compare blocks and its group_options by @bvanjoi in #4967
- fix: get js chunk filename by @ahabhgk in #4971
Other Changes
- chore(runtime-diff): align module decorator runtime modules with webpack by @LingyuCoder in #4891
- chore(runtime-diff): alignment of hot module replacement runtime module by @LingyuCoder in #4856
- chore: remove all skipLibCheck by @xiaoxiangmoe in #4910
- chore: add build:cli:release:{platform} scripts by @aweary in #4859
- test: prevent .DS_store been add to test cases on macos by @LingyuCoder in #4920
- refactor: de-hardcoded module factory and move mf out of core by @ahabhgk in #4925
- chore: deprecate @rspack/plugin-node-polyfill by @hardfist in #4937
- chore: add debug info under panic with debug build by @h-a-n-a in #4940
- chore(runtime-diff): alignment of get chunk filename by @LingyuCoder in #4500
- refactor: error and diagnostics by @h-a-n-a in #4866
- refactor:
miette::Error
asDiagnostic
andrspack_error::Error
by @h-a-n-a in #4892 - chore: optimize diff test case by @LingyuCoder in #4950
- refactor: should not always rely on
Result
by @h-a-n-a in #4880 - chore(webpack-test): enable resolving/browser-field tests by @Boshen in #4952
- test(runtime): add test case of using [id] in get chunk filename runtime module by @LingyuCoder in #4972
- chore(runtime-diff): alignment of startup chunk dependencies runtime module by @LingyuCoder in #4508
New Contributors
Full Changelog: v0.4.2...v0.4.3
v0.4.2
Highlights
experiments.rspackFuture.newTreeshaking
the new tree shaking implementation specifically addressing compatibility issues with webpack architecture and optimizing for reduced output size.
(see below for a detailed explanation)
optimization.mangleExports
allow rspack to control export mangling.
(see below for a detailed explanation)
What's Changed
Exciting New Features 🎉
- feat: JsAsset remove version field by @jerrykingxyz in #4836
- feat: support ecosystem-ci suiteRef trigger by @ahabhgk in #4847
- feat: do not convert panics to results by @h-a-n-a in #4848
- feat: implement
ChunkGraph.getChunkModulesIterable
andChunkGraph.getChunkEntryModulesIterable
by @xc2 in #4855 - feat(runtime-diff): alignment of wasm async loading runtime module by @LingyuCoder in #4863
- feat: align webpack - allow
false
foroptimization.splitChunks
on options validation by @xc2 in #4883 - feat: mangle exports by @IWANABETHATGUY in #4805
- feat: support scriptType by @faga295 in #4814
- feat: extract data from mf generated code by @ahabhgk in #4799
Bug Fixes 🐞
- fix: include tpl string into bail out module ident by @bvanjoi in #4810
- fix(plugin-react-refresh): fix peer warning and reduce dependencies by @chenjiahan in #4807
- fix: bump styled_components and add tests by @nieyuyao in #4813
- fix: updated swc to solve the asciionly bug by @bvanjoi in #4824
- fix: repeat report view link in stats report by @LingyuCoder in #4829
- fix: nested new url by @ahabhgk in #4831
- fix(resolver): resolve query and fragments with unicode filenames by @Boshen in #4830
- fix: remove @ts-expect-error in rspack-plugin-html by @HerringtonDarkholme in #4852
- fix(css): dedup for css module keys by @bvanjoi in #4867
- fix: js files are not minified well when outputModule is true (#4819) by @xc2 in #4857
- fix: enable "context-weak" by @bvanjoi in #4870
- fix: production environment refreshPlugin error by @dribble-njr in #4875
- fix(e2e): remove dev-client based e2e testing cases to fix e2e testing by @xc2 in #4884
- fix: chunk modules test on windows by @ahabhgk in #4894
New Contributors
- @xc2 made their first contribution in #4855
- @dribble-njr made their first contribution in #4875
Full Changelog: v0.4.1...v0.4.2
experiments.rspackFuture.newTreeshaking
This quarter, substantial efforts were dedicated to enhancing tree shaking. While the older tree shaking method remains applicable in most scenarios, it lacks full compatibility with webpack architecture, resulting in divergent behaviors compared to webpack. Additionally, it may produce larger output in certain scenarios when contrasted with webpack. For example, efforts were made to address these issues and optimize tree shaking for improved performance and compatibility.
One of the noteworthy enhancements is the reduction in generated output size. The revamped tree shaking is designed to produce leaner output, particularly when compared to certain scenarios with the previous tree shaking implementation. Here is an example:
source
// index.js
import { a } from './lib.js'
a
// lib.js
export * from './a.js'
// a.js
export const a = 3;
export const b = 3;
package.json
{
"sideEffects": false
}
rspack.config.js
const rspack = require("@rspack/core");
/** @type {import('@rspack/core').Configuration} */
const config = {
entry: "./src/index.js",
plugins: [
],
experiments: {
rspackFuture: {
newTreeshaking: false // `newTreeshaking` disable by default
}
},
optimization: {
moduleIds:"named", // use nanmed moduleIds and disable `minize` for better demonstration
minimize: false
},
};
module.exports = config;
Since the whole module is side effects free, we could directly import a
from a.js
. This could eliminate lib.js
in output.
with old tree shaking
// skip runtime code ...
var __webpack_modules__ = {
"./src/a.js": (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
a: function() { return a; }
});
const a = 3;
const b = 3;
}),
"./src/index.js": (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */var _lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib */"./src/lib.js");
_lib__WEBPACK_IMPORTED_MODULE_0__.a;
}),
"./src/lib.js": (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */var _a__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./a */"./src/a.js");
__webpack_require__.es(_a__WEBPACK_IMPORTED_MODULE_0__, __webpack_exports__);
}),
}
with new tree shaking
enable experiments.rspackFuture.newTreeshaking
const rspack = require("@rspack/core");
/** @type {import('@rspack/core').Configuration} */
const config = {
// ...
experiments: {
rspackFuture: {
- newTreeshaking: false
+ newTreeshaking: true
}
},
// ...
};
module.exports = config;
output
var __webpack_modules__ = {
"./src/a.js": (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
a: function() { return a; }
});
const a = 3;
const b = 3;
}),
"./src/index.js": (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */var _lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib */"./src/a.js");
_lib__WEBPACK_IMPORTED_MODULE_0__.a;
}),
}
The new treeshaking implementation is still undergoing stability testing; hence, it remains disabled by default. If you wish to experiment with it, you can enable it by using the following:
const rspack = require("@rspack/core");
/** @type {import('@rspack/core').Configuration} */
const config = {
// ...
experiments: {
rspackFuture: {
newTreeshaking: true
}
},
// ...
};
module.exports = config;
more details you could refer:
https://www.rspack.dev/config/experiments.html#experimentsrspackfuturenewtreeshaking
and related options:
optimization.mangleExports
optimization.mangleExports
allows to control export mangling.
Reuse the previous example, making slight modifications for a better explanation.
// index.js
- import { aaa } from './lib.js'
+ import { aaa } from './lib.js'
- a
+ aaa
// lib.js
export * from './a.js'
// a.js
- export const aaa = 3;
+ export const aaa = 3;
export const b = 3;
Enable experiments.rspackFuture.newTreeshaking
and optimization.mangleExports
Output
The export of module src/a.js was condensed into a single letter, leading to a decrease in the overall output size.
var __webpack_modules__ = {
"./src/a.js": (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
P: function() { return aaa; }
});
const aaa = 3;
const b = 3;
}),
"./src/index.js": (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */var _lib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib */"./src/a.js");
_lib__WEBPACK_IMPORTED_MODULE_0__.P;
}),
}
Note this feature is not stable yet, and requires experiments.rspackFuture.newTreeshaking
to be enabled.
v0.4.1
Highlights
- Support
compiler.hooks.shouldEmit
hook: Return a boolean telling whether to emit. - Support
compilation.hooks.childCompiler
hook: Executed after created a childCompiler. - Support function type
splitChunks.cacheGroups.{cacheGroup}.test
What's Changed
Performance Improvements ⚡
- perf: reduce aggregateTimeout to speed up HMR by @chenjiahan in #4724
- perf: compilation.hooks.optimizeChunkModules auto disable by @jerrykingxyz in #4756
Exciting New Features 🎉
- feat: support function type for
splitChunks.{cacheGroup}.{test, name}
by @bvanjoi in #4722 - feat: support Chunk.groupsIterable and ChunkGroup.getParents by @bvanjoi in #4641
- feat(plugin-driver): add execute module by @JSerFeng in #4737
- feat: support
Compiler.shouldEmit
by @bvanjoi in #4742 - feat: Module Federation, part 1, ContainerPlugin by @ahabhgk in #4642
- feat: support
compilation.hooks.childCompiler
by @bvanjoi in #4773 - feat: Module Federation, part 2, ContainerReferencePlugin by @ahabhgk in #4735
- feat: bump swc to support
format.inline_script
by @bvanjoi in #4786 - feat: Module Federation, part 3, ProvideSharedPlugin by @ahabhgk in #4778
- feat: Module Federation, part 4, ConsumeSharedPlugin by @ahabhgk in #4783
- feat: support String.raw for context module by @faga295 in #4764
Bug Fixes 🐞
- fix: 🐛assignDeterministicIds alignment by @IWANABETHATGUY in #4693
- fix: 🐛 should invoke
visit_prop
anyway in inner_graph by @IWANABETHATGUY in #4683 - fix(harmony-deps-scanner): should only be
dep.call=true
in call_expr or tagged template's tag by @JSerFeng in #4701 - fix: sort by chunk name before merge duplicate chunk by @bvanjoi in #4725
- fix: compare chunks by modules by @ahabhgk in #4732
- fix(harmony-import-specifier-dep-scanner): add new expr into consideration by @JSerFeng in #4729
- fix: remove @types/webpack-dev-server by @jerrykingxyz in #4744
- fix: use fixed version for rspack in template by @zoolsher in #4746
- fix: typos by @yiliang114 in #4761
- fix: zod-validation-error type error by @xiaoxiangmoe in #4763
- fix: only register
SplitChunkPlugin
once by @bvanjoi in #4766 - fix: flag side effects plugin update dep by @IWANABETHATGUY in #4747
- fix uniqueName Acquisition method by @ityuany in #4670
- fix: regex flags by @nomyfan in #4781
- fix: keep the query passed to loader by @bvanjoi in #4782
- fix: dir path ends with * by @ahabhgk in #4790
- fix: mf test on windows by @ahabhgk in #4793
- fix: use correct DefinePlugin in plugin-react-refresh by @ahabhgk in #4794
- fix: throw error when there had conflict between
chunkName
andentryPointChunk
by @bvanjoi in #4795 - fix: windows test by @ahabhgk in #4796
Other Changes
- chore: remove angular example by @LingyuCoder in #4710
- refactor: block-based code-splitting by @ahabhgk in #4680
- chore: skip show sccache stats by @jerrykingxyz in #4706
- chore: remove angular pnpm lock by @LingyuCoder in #4711
- chore(webpack-test): remove the flaky test which requires on timings by @Boshen in #4715
- chore: fix typos by @Priestch in #4700
- chore(chunk_graph): improve chunk_graph perf by @JSerFeng in #4716
- ci: improve webpack-test stability by @Boshen in #4726
- chore: use eprintln to report error for runtime_requirements by @JSerFeng in #4717
- chore: self hosted macos skip remove sdk by @jerrykingxyz in #4733
- chore: compat get default export by @LingyuCoder in #4731
- chore: commonjs exports dependency by @LingyuCoder in #4720
- refactor: move impl_runtime_module macro to core by @ahabhgk in #4738
- release: 0.4.0 by @h-a-n-a in #4041
- chore: ci set pnpm store-dir in project by @jerrykingxyz in #4743
- chore: fix debugger launcher on window by @h-a-n-a in #4750
- chore: upgrade template to 0.4.0 by @hardfist in #4752
- chore: rspack test tools diff by @LingyuCoder in #4668
- chore: diff trigger by @LingyuCoder in #4755
- chore: diff trigger test by @LingyuCoder in #4760
- ci: remove diff test from release workflow by @LingyuCoder in #4768
- chore(webpack-test): make tests more future proof by @Boshen in #4758
- chore: canary release add windows and enable windows ci on main branch by @jerrykingxyz in #4772
- chore: bump nodejs_resolver by @bvanjoi in #4791
New Contributors
- @Priestch made their first contribution in #4700
- @yiliang114 made their first contribution in #4761
- @ityuany made their first contribution in #4670
- @nomyfan made their first contribution in #4781
Full Changelog: v0.4.0...v0.4.1