npm @rspack/cli 2.0.0
v2.0.0

7 hours ago

⚡️ Rspack 2.0 Released! ⚡️


What's Changed

Breaking Changes 🛠

Performance Improvements ⚡

New Features 🎉

  • feat: improve external module rendering by @JSerFeng in #12813
  • feat: builtin react server component by @SyMind in #12012
  • feat: expose dependency loc to js by @JSerFeng in #12840
  • feat: add cache.portable configuration by @jerrykingxyz in #12842
  • feat: support import.defer() for statical path by @ahabhgk in #12900
  • feat(rstest): only handle global variables when globals is true by @9aoy in #12921
  • feat: add beforeModuleIds hook by @hamlim in #12809
  • feat: support import.defer() for context module by @ahabhgk in #12938
  • feat: support MF share treeshake by @2heal1 in #12250
  • feat: make license banner comment more concise by @chenjiahan in #12960
  • feat: preserve tla expr for EsmLibrary by @JSerFeng in #12942
  • feat: add support for readonly persistent cache by @cellison-figma in #12902
  • feat(css): introduce resolveImport parser option for css parser to choose whether to resolve @import syntax by @JSerFeng in #12672
  • feat: add the map of json data size to rspack_plugin_rsdoctor for use rsdoctor by @yifancong in #12950
  • feat: splitChunks for EsmLibraryPlugin by @JSerFeng in #12521
  • feat: automatically split runtime chunk by @JSerFeng in #13123
  • feat: optimize star exports from externals by @JSerFeng in #13050
  • feat: optimize dyn import for esm output by @JSerFeng in #13121
  • feat: making RSC compatible with lazy compilation by @SyMind in #13136
  • feat: cjs require destructuring assignment tree shaking by @ahabhgk in #13149
  • feat: keep unknown import.meta properties by @intellild in #12796
  • feat(javascript): align scope termination and DCE with webpack by @LingyuCoder in #13147
  • feat: support strict this context on imports by @ahabhgk in #13169
  • feat: rsdoctor support the side effects infos by @yifancong in #12983
  • feat(javascript): improve const eval by @LingyuCoder in #13167
  • feat(stats): enable stats.colors by default when environment supports by @LingyuCoder in #13161
  • feat(esm-library): auto-name unnamed dynamic import chunks with deterministic module name by @JSerFeng in #13172
  • feat(deps): update @rspack/dev-server to 2.0.0-beta.1 by @chenjiahan in #13205
  • feat: cjs require variable property access tree shaking by @ahabhgk in #13155
  • feat: enable mangle exports for cjs full require by @ahabhgk in #13212
  • feat(esm-library): deduplicate non-concatenated external modules after scope hoisting by @JSerFeng in #13210
  • feat(esm): optimize dynamic import exports for namespace and tree-shaking by @JSerFeng in #13211
  • feat: support regex flags and JavaScript lookaheads in extractComments condition by @Copilot in #12990
  • feat(mf): shareScope support array type by @2heal1 in #13107
  • feat: add Node.js version check during initialization by @chenjiahan in #13261
  • feat: rsc support disable client api checks by @SyMind in #13263
  • feat: update devServer types for @rspack/dev-server v2 by @chenjiahan in #13278
  • feat(create-rspack): add Rstest as an optional tool by @chenjiahan in #13300
  • feat: support rsc manifest callback by @SyMind in #13277
  • feat: rspack_plugin_rsdoctor add collect connections function by @yifancong in #13181
  • feat: tree shaking for inlined members access dynamic import by @ahabhgk in #13381
  • feat: add EsmNodeTargetPlugin for ESM-aware node builtin externals by @JSerFeng in #13370
  • feat(rsdoctor): add support for dependency connections by @yifancong in #13384
  • feat: enable mangle exports for cjs reexport by @ahabhgk in #13413
  • feat(rstest): support unmockRequire methods by @9aoy in #13412
  • feat(create-rspack): update typescript to v6 by @chenjiahan in #13445
  • feat(swc-loader): add detectSyntax option to infer parser by @chenjiahan in #13467
  • feat: support import.meta.main by @ahabhgk in #13489
  • feat: support expression in import.meta.resolve argument by @ahabhgk in #13523
  • feat: add ModuleGraph.getUsedExports to ModuleGraph by @SyMind in #13519
  • feat: Implement HashedModuleIdsPlugin by @aancuta in #13197
  • feat: add TryFutureConsumer with short-circuit cancellation by @jerrykingxyz in #13554
  • feat(binding): add active-related APIs to ModuleGraphConnection by @JSerFeng in #13548
  • feat: support optimize side effects free function calls by @JSerFeng in #12559
  • feat(node-binding): add external wasm debug info for wasm dwarf debugging by @hardfist in #13638
  • feat(create-rspack): modernize starter template configs by @chenjiahan in #13645
  • feat(split-chunks): support enforceSizeThreshold option by @jaehafe in #13576
  • feat(resolve): support #/ subpath alias import by @stormslowly in #13633
  • feat(create-rspack): reuse rspack config in rstest templates by @chenjiahan in #13666
  • feat: enforce macro-generated implemented_hooks in debug builds by @SyMind in #13677
  • feat: only apply require-* parser plugins to js-auto/js-dynamic by @SyMind in #13678
  • feat: skip building side-effect-only imports in make by @ahabhgk in #13688
  • feat: add compiler.hooks.shouldRecord for NoEmitOnErrorsPlugin by @stormslowly in #13630
  • feat(cli): use jiti to load typescript config by @hardfist in #13690
  • feat: expose jsonp template plugin by @ahabhgk in #13700
  • feat(config): update default performance budgets by @chenjiahan in #13717
  • feat: support relative output.path relative to context by @hardfist in #13718
  • feat(create-rspack): add optional agent skills by @chenjiahan in #13729
  • feat: persistent cache for swc js minimizer plugin by @ahabhgk in #13706
  • feat(cli): add --open / --no-open to rspack dev / serve by @mvanhorn in #13777

Bug Fixes 🐞

  • fix: failed to resolve 'browserslist-load-config' module by @chenjiahan in #12767

  • fix: correct watchpack require path by @chenjiahan in #12771

  • fix(browser): fix @rspack/browser failure after pure esm transformation by @Timeless0911 in #12781

  • fix(mf): async startup e2e test by @ahabhgk in #12808

  • fix(template): add @rspack/dev-server to dev dependencies by @LingyuCoder in #12821

  • fix: normalize paths for extract source map by @ahabhgk in #12825

  • fix(mf): use dynamic exports type for MF modules by @ahabhgk in #12841

  • fix: should not panic when access slate stats by @SyMind in #12839

  • fix(mf): prevent entry-specific chunks from polluting manifest assets and refactor manifest generation by @2heal1 in #12836

  • fix: enable panic backtrace for release-debug profile by @Copilot in #12856

  • fix(mf): respect request changes in shared plugins by @ahabhgk in #12863

  • fix: prevent panic on template literals with invalid escape sequences by @Copilot in #12867

  • fix: rsc should handle concat module in build server manifest by @SyMind in #12859

  • fix: fix used exports for global entry that inject to async entrypoints by @ahabhgk in #12883

  • fix: should render export name when re-export from different modules by @JSerFeng in #12886

  • fix: unsafe cache cannot watch symlink by @SyMind in #12885

  • fix: prevent server actions from being removed in production build by @SyMind in #12898

  • fix(rstest): rstest.importActual not work when imported from @rstest/core by @9aoy in #12908

  • fix: build_chunk_graph recover logic by @hardfist in #12920

  • fix: rsc plugin stats should use AtomicRefCell by @SyMind in #12923

  • fix: context dependencies hash calculation use cache.snapshot configuration by @jerrykingxyz in #12937

  • fix: RSC fails to properly handle Windows paths by @SyMind in #12969

  • fix: webpack_chunk_load api compile wrong by @SyMind in #12971

  • fix: Replace AtomicRefCell with Mutex in RSC Coordinator by @SyMind in #12972

  • fix: port webpack fix for webpack_module name collision by @Copilot in #12956

  • fix: preserve import external without modify mg by @JSerFeng in #12973

  • fix: allow to export the same name of same local, fix entry splitting algorithm by @JSerFeng in #13000

  • fix(esm-lib-plugin): support inline export for dyn import by @JSerFeng in #12949

  • fix: enable requireAsExpression by default again and not to throw warning when requireAlias is disabled by @LingyuCoder in #12998

  • fix: prevent module point to wild pointer by @SyMind in #13021

  • fix(core): missing @rspack/lite-tapable types by @chenjiahan in #13031

  • fix: allow both 0.24+ and 2.0+ of @module-federation/runtime-tools by @chenjiahan in #13039

  • fix: infinite loop in is_available_chunk when chunk groups form a cycle by @SyMind in #13042

  • fix: normalize file dependencies paths in CopyPlugin to prevent incorrect rebuild triggers by @SyMind in #13043

  • fix(module-federation): encode runtime data URI and support named wrappers by @BleedingDev in #12982

  • fix: generating correct types for @rspack/lite-tapable by @colinaaa in #13048

  • fix(rstest): hoist importActual ESM imports by @9aoy in #13025

  • fix(rstest): replace mockRequire to rstest_mock_require by @9aoy in #13056

  • fix: compile document fragments in HtmlRspackPlugin by @LingyuCoder in #13103

  • fix: should not treat module with module variable as esm compatible by @JSerFeng in #13129

  • fix: preserve optional chaining in CommonJS self-reference expressions by @LingyuCoder in #13132

  • fix(core): type issues when skipLibCheck is disabled by @chenjiahan in #13138

  • fix: skip SRI for external URLs not under publicPath by @LingyuCoder in #13134

  • fix: remove useless dyn_refs by @JSerFeng in #13148

  • fix: when there are 2+ dep targets in the same chunk, create facade chunks for all of them by @JSerFeng in #13154

  • fix(html): handle html fragments and diagnostics by @LingyuCoder in #13178

  • fix: try catch return statement DCE by @LingyuCoder in #13179

  • fix: revert lastCompilation check for stats by @hardfist in #13214

  • fix(esm-library): fix dynamic import of same-chunk concatenated modules and external name deconfliction by @JSerFeng in #13220

  • fix: Fix stats artifact fallback warning test to use stale stats by @hardfist in #13219

  • fix: Remove DerefMut impl from ArcPath by @hardfist in #13235

  • fix(defaults): make module rules regex case-sensitive by @LingyuCoder in #13238

  • fix: dup external module declarations by @JSerFeng in #13231

  • fix: merge exports info when merging external modules by @JSerFeng in #13257

  • fix(create-rspack): update @rspack/dev-server to 2.0.0-beta.4 by @chenjiahan in #13268

  • fix: avoid import duplicate identifiers by @JSerFeng in #13267

  • fix: restore panic backtrace for macOS arm64 bindings by @hardfist in #13283

  • fix(collections): use FxHasher for Ukey by @hardfist in #13293

  • fix(esm-lib): tree-shake unused exports, fix property_access name collision and get_binding panic by @JSerFeng in #13288

  • fix: cjs tree shaking used with named export by @ahabhgk in #13303

  • fix: huge file dependencies cause range error by @SyMind in #13305

  • fix: dynamic import tree shaking used with named export by @ahabhgk in #13307

  • fix: correct dev server types by @chenjiahan in #13313

  • fix(rstest): prevent the re-exports optimization for mocked modules by @9aoy in #13262

  • fix(esm-lib): render init fragments after import source by @JSerFeng in #13308

  • fix: normal runtime use should not contains require function by @JSerFeng in #13190

  • fix: strict this context for dynamic import and cjs require by @ahabhgk in #13328

  • fix(javascript): preserve live code after labeled breaks by @LingyuCoder in #13325

  • fix: WorkerPlugin should be inherented in children compiler by @stormslowly in #13310

  • fix(parser): avoid treating require.resolve chains as require by @Timeless0911 in #13341

  • fix(esm-lib): avoid exporting webpack_require and useless runtime when runtimeChunk is false by @JSerFeng in #13374

  • fix: optimize concatenated module code generation hot paths by @LingyuCoder in #13375

  • fix: avoid analyze cjs tree shaking for user defined require by @ahabhgk in #13401

  • fix(esm-lib): replace panics in get_module_chunk with Result-based error handling by @JSerFeng in #13396

  • fix(rsc): should compile css without use server-entry by @SyMind in #13402

  • fix: deduplicate source name stable by @SyMind in #13416

  • fix(esm-library): deduplicate external module import identifiers in ESM output by @JSerFeng in #13418

  • fix(esm-lib): use package name for node_modules short name in dynamic imports by @JSerFeng in #13406

  • fix: add coverage for esm library linking, and fix linking errors by @JSerFeng in #13424

  • fix: should enforce orphan:false for concatenated module by @JSerFeng in #10317

  • fix: lightningcss with previous loader source maps by @SyMind in #13436

  • fix: duplicate-sources-order by @SyMind in #13438

  • fix(core): implement new Map methods on Compilation.entries by @chenjiahan in #13444

  • fix(core): preserve external namespace access in esm externals by @JSerFeng in #13442

  • fix: keep empty entry runtime chunk for modern-module render by @Timeless0911 in #13452

  • fix(esm-library): support star reexport namespaces by @JSerFeng in #13448

  • fix(core): bump rslib and fix type related issues by @Timeless0911 in #13376

  • fix: use Symbol.for() for shared symbol identity in module bindings by @tryggvigy in #13457

  • fix(rsc): tree shaking client barrel by @SyMind in #13472

  • fix: import.meta.resolve() and add tests by @ahabhgk in #13469

  • fix(rstest): resolve manual mock targets with resolver by @9aoy in #13439

  • fix(esm-library): avoid duplicate webpack_require export by @JSerFeng in #13483

  • fix: improve pure comment matching by @JSerFeng in #13498

  • fix(esm): deconflict external bindings in module output by @JSerFeng in #13466

  • fix(watcher): rename typo recursiron_directories to recurse_parent_directories by @jaehafe in #13510

  • fix: avoid spreading huge dependency iterables by @SyMind in #13517

  • fix(types): allow partial jsc.parser config when detectSyntax is auto by @chenjiahan in #13531

  • fix(swc-loader): fallback detectSyntax auto for virtual modules by @chenjiahan in #13529

  • fix: reset chunk.rendered in incremental build by @hardfist in #13544

  • fix(cli): surface fatal errors and unhandled rejections on process exit by @briansilah in #13506

  • fix: multicompiler devServer false support in serve by @LingyuCoder in #13572

  • fix(cli): bundle lazy-loaded helper deps by @chenjiahan in #13587

  • fix: cjs self reference mangle exports by @ahabhgk in #13588

  • fix(esm-library): emit empty export for empty node chunks by @JSerFeng in #13462

  • fix(wasm): avoid blocking-thread work under node:wasi by @hardfist in #13598

  • fix(core): move connection states to ModuleGraphConnection by @JSerFeng in #13624

  • fix(side-effects): respect DefinePlugin purity evaluation by @ahabhgk in #13628

  • fix(externals): correct external type for aliased node builtin externals by @JSerFeng in #13627

  • fix(browser): import napi symbols from binding by @CPunisher in #13641

  • fix(core): fix cjs export function tree shaking by @ahabhgk in #13643

  • fix(config): tighten rule loader/use typings by @kyungilcho in #13514

  • fix: add @emnapi/core and @emnapi/runtime as dependencies by @CPunisher in #13665

  • fix(loader): preserve additionalData in builtin loaders by @ahabhgk in #13661

  • fix(cli): disable hmr in preview by @chenjiahan in #13669

  • fix(hash): keep fullhash in sync with css-only content changes by @GiveMe-A-Name in #13491

  • fix(watcher): flush pending events on unpause to prevent stuck files_data by @stormslowly in #13603

  • fix(watcher): filter stale FSEvents with mtime baseline comparison by @stormslowly in #13610

  • fix(rstest): respect importFunctionName when importDynamic is disabled by @9aoy in #13673

  • fix: fix flaky wasm tests by @hardfist in #13655

  • fix: support module external type in array externals by @JSerFeng in #13663

  • fix(mf): resolve version from parent package for secondary entry points by @davidfestal in #13636

  • fix(wasm): fix browser e2e timeout by running @rspack/browser builds in a worker by @hardfist in #13687

  • fix: Revert rstest importFunctionName feature when importDynamic is disabled by @9aoy in #13699

  • fix: escape invalid chars anywhere in to_identifier_with_escaped by @JSerFeng in #13707

  • fix: correct app type constraint in DevServerOptions by @chenjiahan in #13711

  • fix(esm-library): deconflict module external helper names by @JSerFeng in #13695

  • fix: render numeric chunk IDs as number literals by @JSerFeng in #13604

  • fix: align logger timing with webpack by @hardfist in #13721

  • fix(esm_library): extract TLA shared modules to break circular dependency by @JSerFeng in #13606

  • fix: rsc plugins dead lock by @SyMind in #13736

  • fix: rspack sources cache save and recovery by @ahabhgk in #13731

  • fix(css-extract): propagate css loading runtime requirements by @SyMind in #13746

  • fix(rstest): avoid async wrapper for sync mock factories by @9aoy in #13764

  • fix(esm-library): handle CSS modules in preserveModules by @JSerFeng in #13670

  • fix(mf): remove debug assertions from collect_expose_requirements function by @2heal1 in #13773

  • fix(rsc): render client component CSS as stylesheet resources by @SyMind in #13769

  • fix(test-tools): move wast-loader to dependencies by @colinaaa in #13782

  • fix(rstest): preserve mock hoist positions in cache by @9aoy in #13775

Refactor 🔨

Document Updates 📖

Other Changes

New Contributors

Full Changelog: v1.7.11...v2.0.0

Don't miss a new cli release

NewReleases is sending notifications on new releases.