npm @rspack/cli 2.1.0-beta.0
v2.1.0-beta.0

6 hours ago

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 }
image

What's Changed

New Features 🎉

Performance 🚀

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 overrideStrict for 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 📖

Other Changes

New Contributors

Full Changelog: v2.0.8...v2.1.0-beta.0

Don't miss a new cli release

NewReleases is sending notifications on new releases.