Highlights 💡
Support React Compiler in builtin:swc-loader
React projects can now use React Compiler directly through Rspack's built-in SWC loader. See the React Compiler guide for details.
export default {
module: {
rules: [
{
test: /\.[cm]?[jt]sx?$/,
loader: 'builtin:swc-loader',
options: {
jsc: {
transform: {
reactCompiler: true,
},
},
},
},
],
},
};Side-effect-free function analysis by default
Rspack's side-effect-free function analysis is now enabled by default in production builds. It can detect pure function calls through the #__NO_SIDE_EFFECTS__ notation and pureFunctions configuration, including exported functions across module boundaries. When the returned value is unused, Rspack can remove the call more reliably and improve tree shaking results without extra configuration. See experiments.pureFunctions for details.
// lib.js
/*@__NO_SIDE_EFFECTS__*/
export function call() {
console.log('hi')
}
// barrel.js
import { call } from './lib'
const value = call()
// if value is unused, call can be removed
export { value }
What's Changed
New Features 🎉
- feat: expose module error JS API by @SyMind in #14351
- feat(cache): log persistent cache read and write timings by @hardfist in #14314
- feat(module_graph): expose
getProvidedExports()to JS API by @logonoff in #14349 - feat: support drop inactive branch dependencies for member expr by @ahabhgk in #14382
- feat(runtime): introduce experimental.runtimeMode by @LingyuCoder in #14254
- feat: support branch guarded export presence for
inon ESM imports by @ahabhgk in #14426 - feat: bump swc to support react compiler by @CPunisher in #14435
- feat(runtime): runtime internals of rspack runtime mode by @LingyuCoder in #14427
- feat(rsdoctor): expose export usage graph by @JSerFeng in #14291
- feat: enable pureFunctions by default by @JSerFeng in #14465
- feat(cache): add maxAge and maxGenerations for persistent cache cleanup by @matthewdavis-oai in #14296
Performance 🚀
- perf: remove serde json by @SyMind in #14272
- perf: use mask intersects instead of flag iteration for scope globals by @stormslowly in #14353
- perf: add ASCII fast path for dependency location column computation by @stormslowly in #14355
- perf: force DFA automaton for real content hash scanning by @stormslowly in #14356
- perf(core): reduce memcpy overhead by @hardfist in #14381
- perf: reduce flag dependency usage key allocations by @LingyuCoder in #14417
- perf: reduce build chunk graph preparation work by @LingyuCoder in #14421
- perf(sources): avoid cloning source maps with borrowed fields by @SyMind in #14380
- perf: optimize module concatenation traversal by @LingyuCoder in #14422
- perf(loader-runner): cache esm loader imports by @hardfist in #14434
- perf(core): optimize resource parsing by @chenjiahan in #14456
- perf(ci): drop redundant cargo check from rust CI by @stormslowly in #14461
- perf: avoid JavaScriptTracer overhead when tracing is disabled by @chenjiahan in #14468
- perf(loader-runner): reduce loader object construction overhead by @chenjiahan in #14477
Bug Fixes 🐞
- fix: preserve inline source content for transform sourcemaps by @intellild in #14350
- fix: remove webpackSource and webpackDefer magic comments by @ahabhgk in #14364
- fix: apply global
overrideStrictfor ContextModule by @colinaaa in #14361 - fix(watcher): filter ignored-subtree events that emit a spurious folder change by @stormslowly in #14329
- fix: use ChunkWithSizeInfo delimiter in maxInitialSize chunk naming fallback path by @wr40000 in #14331
- fix: wait for in-flight build before closing compiler by @stormslowly in #14377
- fix(browser): point wasi-worker-browser export to dist file by @stormslowly in #14415
- fix(tree-shaking): handle nested pure function calls by @JSerFeng in #14375
- fix: cherry-pick mf manifest expose assets by @2heal1 in #14339
- fix: cache import.meta filename and dirname outside eval by @intellild in #14423
- fix(pure-functions): keep deferred pure import callees by @JSerFeng in #14425
- fix: improve createRequire argument parsing by @JSerFeng in #14424
- fix(rstest): preserve mocks in module chunk loading by @9aoy in #14472
- fix(rspack_watcher): prevent watch-root panic from orphaned path tree by @stormslowly in #14448
- fix(test): isolate source for fixture-writing config cases by @stormslowly in #14462
- fix: change default value of createRequire parsing to false by @JSerFeng in #14482
Refactor 🔨
- refactor(binding): consolidate module property definitions by @SyMind in #14365
- refactor: remove unused unresolved context from pure checks by @CPunisher in #14433
Document 📖
- docs: document source phase imports by @chenjiahan in #14360
- docs: fix optimization config types by @chenjiahan in #14370
- docs: document split chunks options by @chenjiahan in #14371
- docs: add Remotion to ecosystem by @chenjiahan in #14374
- docs: update magic comment version and anchors by @chenjiahan in #14378
- docs: update Vite comparison docs by @chenjiahan in #14412
- docs: update Rollup comparison docs by @chenjiahan in #14413
- docs: update rules use parallel type by @chenjiahan in #14416
- docs: add instructions for unsupported platforms by @swwind in #14442
- docs(website): fix Rspress summary style by @chenjiahan in #14449
- docs: improve incremental config docs by @chenjiahan in #14450
- docs: add GitHub to who is using by @chenjiahan in #14474
Other Changes
- revert: "fix: temporarily revert JS parser changes causing runtime err" by @CPunisher in #14347
- chore: add scope hoisting regression for for-init references by @CPunisher in #14352
- chore(ci): update ecosystem ci action to v0.3.2 by @Timeless0911 in #14362
- chore(ci): use mini runner to offload lightweight CI jobs by @stormslowly in #14363
- chore(ci): use mini runner for lint workflow by @chenjiahan in #14376
- chore(deps): group emnapi renovate updates by @chenjiahan in #14390
- chore(deps): update dependency terser-webpack-plugin to ^5.6.1 by @renovate[bot] in #14393
- test(wasm): skip file-dependencies-huge to fix flaky afterAll timeout by @stormslowly in #14399
- chore(deps): update yarn to v4.16.0 by @renovate[bot] in #14396
- chore(deps): update dependency http-proxy-middleware to ^4.1.0 by @renovate[bot] in #14392
- chore(deps): update dependency rspack-merge to v1 by @renovate[bot] in #14397
- chore(deps): update dependency ts-checker-rspack-plugin to ^1.4.0 by @renovate[bot] in #14394
- chore(deps): update dependency @rslint/core to v0.6.1 by @renovate[bot] in #14391
- chore(deps): update dependency semver to ^7.8.4 by @renovate[bot] in #14408
- chore(deps): update pnpm to v11.6.0 by @renovate[bot] in #14409
- chore(deps): update dependency acorn to ^8.17.0 by @renovate[bot] in #14407
- chore(deps): update patch crates by @renovate[bot] in #14385
- chore(deps): update patch npm dependencies by @renovate[bot] in #14386
- chore(deps): update react and @rspack/plugin-preact-refresh by @renovate[bot] in #14406
- chore: bump swc exp from 0.10.0 to 0.11.0 by @CPunisher in #14379
- chore(ci): split wasm release build into parallel wasi/browser jobs by @stormslowly in #14414
- chore(deps): update emnapi to v1.11.1 by @renovate[bot] in #14395
- chore(deps): bump swc_ecma_minifier to 55.0.2 for template-literal minify fix by @pkasarda in #14428
- chore: speed up crate release pipeline by @stormslowly in #14429
- chore(ci): use forked CodSpeed runner by @hardfist in #14432
- chore: limit walltime bench triggers by @hardfist in #14441
- chore: bump @rslint/core to 0.6.2 by @fansenze in #14470
- ci: disable debuginfo for the windows ci binding build by @stormslowly in #14479
New Contributors
- @wr40000 made their first contribution in #14331
- @pkasarda made their first contribution in #14428
- @swwind made their first contribution in #14442
- @matthewdavis-oai made their first contribution in #14296
Full Changelog: v2.0.8...v2.1.0-beta.0