npm @rspack/core 2.3.2
v2.3.2

one hour ago

Highlights 💡

More reliable HMR, fewer full-page reloads

HMR now handles code-splitting changes more reliably, reducing unnecessary full-page reloads when chunks are added or rearranged. Newly required chunks are loaded before HMR accept callbacks run, and changes to async chunk dependencies no longer cause unnecessary update propagation.

Experimental rule.as

The experimental rule.as option lets a matched resource use a different path for subsequent rule matching while preserving the original resource for file reading and loaders. For example, as: '[resource-path].txt' lets later .txt rules also process example.source.js. (#15917)

// rspack.config.mjs
export default {
  module: {
    rules: [
      {
        test: /\.source\.js$/,
        type: 'asset/source',
        as: '[resource-path].txt',
      },
      { test: /\.txt$/, use: './text-loader.js' },
    ],
  },
};

Here, example.source.js matches the later .txt rule as example.source.js.txt; text-loader.js still receives the contents of the original file.

Skip side-effect-free export * passthrough modules

Rspack can now bypass side-effect-free modules that only forward exports with export *, connecting directly to the underlying module.

Mark the package as side-effect-free in package.json:

{
  "sideEffects": false
}
// src/value.js
export const value = 42;

// src/passthrough.js
export * from './value.js';

// src/index.js
export * from './passthrough.js';

With optimization.sideEffects enabled (the default in production), the export * connection from index.js can now go directly to value.js, skipping passthrough.js.

What's Changed

New Features 🎉

  • feat(sri): support hashLoading: "lazy" in SubresourceIntegrityPlugin by @sd2k in #16374
  • feat: add output.environment.topLevelAwait and await async ESM entries by @hai-x in #16386
  • feat: support externals.byLayer by @stormslowly in #16307
  • feat(css): Add opt-in runtime public paths for injected styles by @scttcper in #15705
  • feat: add experimental rule.as by @intellild in #15917
  • feat(tree-shaking): prune dynamic imports from unused exports by @LingyuCoder in #15449
  • feat: skip side-effect-free export * passthrough modules by @hai-x in #16472

Performance 🚀

Bug Fixes 🐞

  • fix(core): keep property access when inlining an export reached through a re-export by @flex-mookeun in #16310
  • fix(core): keep the full hash stable across rebuilds without HMR by @guru-irl in #16280
  • fix(runtime): avoid coercion collisions in chunk ID matchers by @intellild in #16423
  • fix(devtool): map bootstrap and startup sources by @LingyuCoder in #16426
  • fix: keep receiver exports for calls on unprovided members by @hai-x in #16418
  • fix: restore side-effect imports after package metadata changes by @ahabhgk in #16435
  • fix(cache): reuse completed builds for external and generated modules by @ahabhgk in #16429
  • fix(core): fold chunk hashes into the full hash in chunk id order by @guru-irl in #16293
  • fix: keep initializers of unused top-level using declarations by @hai-x in #16437
  • fix(watcher): preserve concrete paths in native watcher events by @stormslowly in #16411
  • fix(stats): report each runtime module's own size and chunks by @guru-irl in #16076
  • fix(hmr): complete new entry chunk dependencies by @JSerFeng in #15955
  • fix: isolate entry declarations from runtime tables by @ahabhgk in #16497
  • fix: preserve module namespace key order for mixed exports by @LingyuCoder in #16491
  • fix(watcher): separate filesystem accuracy from cache by @stormslowly in #16512
  • fix(watcher): align rename events with watchpack by @stormslowly in #16460
  • fix: skip cyclic star re-exports when resolving a binding by @LingyuCoder in #16496
  • fix: preserve lone surrogates during constant evaluation by @LingyuCoder in #16494
  • fix(watcher): pass SystemTime to mtime_accuracy by @hai-x in #16526
  • fix(resolver): support UTF-8 BOM in tsconfig files by @stormslowly in #16518
  • fix: evaluate x in ns to true when x is a re-exported namespace by @hai-x in #16509
  • fix: preserve negative zero in exports and use JavaScript number strings in constant evaluation by @LingyuCoder in #16527
  • fix(mf): keep the whole requiredVersion range in mf-manifest.json by @arnaud-zg in #16402
  • fix(core): distinguish fatal module errors from loader diagnostics by @ahabhgk in #16538
  • fix(css): scope counter styles and implicit grid lines by @intellild in #16520
  • fix(hmr): invalidate cached chunks when version tags change by @JSerFeng in #16548
  • fix(watcher): account for directory mtime accuracy by @stormslowly in #16531
  • fix(mf): read provided shared fields directly in manifests by @ahabhgk in #16533
  • fix(resolver): report circular tsconfig extends instead of crashing by @stormslowly in #16513
  • fix(hmr): load async groups through their last chunk by @JSerFeng in #16328
  • fix(resolver): reload PnP manifest from cached path by @stormslowly in #16543

Refactor 🔨

  • refactor(binding): rely on napi-rs for module retention by @SyMind in #16431
  • refactor: remove unused exports_definitions hook from ConcatenatedModule by @hai-x in #16434
  • refactor(binding): implement module classes in JavaScript by @SyMind in #16436

Document 📖

Other Changes

New Contributors

Full Changelog: v2.3.1...v2.3.2

Don't miss a new core release

NewReleases is sending notifications on new releases.