Skip to content

Releases

v2.1.0-rc.0

Choose a tag to compare

@LingyuCoder LingyuCoder released this 23 Jun 11:13

What's Changed

New Features 🎉

  • feat: make persistent cache max generations default to 3 by @ahabhgk in #14534

Performance 🚀

Bug Fixes 🐞

  • fix(types): align wasm loading types by @chenjiahan in #14506
  • fix(split-chunks): align max size grouping with webpack by @intellild in #14481
  • fix(rstest): fallback to automock for missing manual mocks by @9aoy in #14418
  • fix(css): preserve undeclared css module idents by @intellild in #14497
  • fix(mf): stabilize consume shared runtime output by @2heal1 in #14532
  • fix(cache): default context_dependencies snapshot strategy to timestamp by @hardfist in #14490

Refactor 🔨

Document 📖

Other Changes

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

v2.1.0-beta.0

Choose a tag to compare

@SyMind SyMind released this 18 Jun 08:35
d61e73b

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

  • 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[b...
Read more

v1.7.12

Choose a tag to compare

@SyMind SyMind released this 17 Jun 12:44
8f907fa

What's Changed

Bug Fixes 🐞

  • fix: align timing logger with webpack phase boundaries by @hardfist in #13559

Document Updates 📖

Other Changes

Full Changelog: v1.7.11...v1.7.12

v2.0.8

Choose a tag to compare

@chenjiahan chenjiahan released this 10 Jun 16:03
ac3fa6a

What's Changed

Bug Fixes 🐞

  • fix: temporarily revert JS parser changes causing runtime errors by @CPunisher in #14343

Other Changes

Full Changelog: v2.0.7...v2.0.8

v2.0.7

Choose a tag to compare

@chenjiahan chenjiahan released this 10 Jun 15:16

Warning

v2.0.7 has been deprecated because it may generate incorrect Rspack build outputs.

Please do not install or use v2.0.7. Upgrade to v2.0.8 instead, which was released as the fix for this issue.

What's Changed

New Features 🎉

Performance 🚀

  • perf(split-chunks): reduce module grouping overhead by @LingyuCoder in #14209
  • perf(sources): preallocate source map mappings buffer by @SyMind in #14288
  • perf(module-graph): store dependencies in dense map by @hardfist in #14290
  • perf(core): use dense dependency id maps in module graph by @hardfist in #14322

Bug Fixes 🐞

  • fix(copy): normalize glob common dir before adding as context dependency by @stormslowly in #14257
  • fix: declarator nested webpack exports by @ahabhgk in #14253
  • fix(css): preserve import render conditions by @intellild in #14218
  • fix(lazy-compilation): reserve closure-library externals on inactive proxy by @stormslowly in #14228
  • fix(css): align dashed idents with webpack by @intellild in #14261
  • fix: preserve shared fallback versions by @2heal1 in #14219
  • fix(library): implement JsonpLibraryPlugin for output.library.type: 'jsonp' by @logonoff in #14278
  • fix(watcher): carry dependency deltas across coalesced rebuilds by @stormslowly in #14279
  • fix(rstest): support mocking dynamic import() of external modules by @fi3ework in #14247
  • fix(css): include local name in hash-only local idents by @intellild in #14334

Refactor 🔨

Document 📖

  • docs: add TanStack Start to ecosystem guide by @chenjiahan in #14259
  • docs(style): dark mode styling for website ApiMeta tag by @Copilot in #14262
  • docs: fix broken documentation links by @chenjiahan in #14316

Other Changes

  • chore: scale threejs walltime benchmark input by @hardfist in #14250
  • chore(deps): update dependency @rstest/core to ^0.10.3 by @renovate[bot] in #14230
  • chore(deps): update dependency enhanced-resolve to v5.22.1 by @renovate[bot] in #14231
  • chore(deps): update dependency terser to v5.48.0 by @renovate[bot] in #14232
  • chore(deps): update dependency ws to ^8.21.0 by @renovate[bot] in #14233

Full Changelog: v2.0.6...v2.0.7

v2.0.6

Choose a tag to compare

@stormslowly stormslowly released this 02 Jun 09:48
0d7244f

Highlights

React Server Components: enforce server-only / client-only boundaries

RSC builds now validate the server-only and client-only marker packages. Importing a client-only module from a server-graph module (or a server-only module from a client-graph module) is reported as a diagnostic. This marker-package validation always runs and is independent of disableClientApiChecks, which now only scopes the React client-API checks.

// server component (server graph)
import 'client-only'; // ❌ reported: client-only imported in a server module

// client component (client graph)
import 'server-only'; // ❌ reported: server-only imported in a client module

Expose DeterministicModuleIdsPlugin

The webpack-compatible deterministic module id plugin is now exposed through the JS API as rspack.ids.DeterministicModuleIdsPlugin, giving you fine-grained control over module ids for long-term caching. It supports the webpack options test, maxLength, salt, fixedLength, and failOnConflict.

const rspack = require('@rspack/core');

module.exports = {
  optimization: { moduleIds: false },
  plugins: [
    new rspack.ids.DeterministicModuleIdsPlugin({
      maxLength: 5,
      failOnConflict: true,
    }),
  ],
};

CSS Modules: preserve composes cascade order

CSS Modules now use a shared topological sort to keep the source order of composes, so composed declarations land in the output cascade in the order you authored them. This fixes subtle specificity surprises when composing local class names across modules.

What's Changed

New Features 🎉

Performance 🚀

Bug Fixes 🐞

  • fix: remove wasmtime threads feature by @hardfist in #14199
  • fix: limit tsfn lifecycle to prevent memory leak by @SyMind in #13565
  • fix(pure-functions): keep deferred local dependencies by @JSerFeng in #14191
  • fix(lazy-compilation): clean up stale entry proxies on dynamic entry removal by @stormslowly in #14170
  • fix: respect resolved external type in ESM rendering by @JSerFeng in #14180
  • fix(esm-library): support context chunk loading by @JSerFeng in #14144
  • fix(rspack_watcher): scan after registering the disk watcher to close a startup race by @stormslowly in #14210
  • fix(esm-library): reuse inline export bindings by @JSerFeng in #14152
  • fix: infer modern-module cjs externals from target by @Timeless0911 in #14215

Document 📖

Other Changes

Full Changelog: v2.0.5...v2.0.6

v2.0.5

Choose a tag to compare

@JSerFeng JSerFeng released this 28 May 06:42
b294ed6

Highlights

Support import.meta.glob

Rspack now supports import.meta.glob, a file-system import API already available in Vite and Turbopack. We chose to align with this ecosystem behavior.

const pages = import.meta.glob('./pages/**/*.tsx', {
  eager: true,
  import: 'default',
  query: { layout: 'docs' },
  base: './pages',
});

More controllable CSS module parsing

CSS modules can now control parsing for @import, animations, custom idents, and dashed idents through module.parser, so projects can match existing CSS Modules behavior more closely while migrating to Rspack.

export default {
  module: {
    parser: {
      'css/module': {
        import: true,
        animation: true,
        customIdents: true,
        dashedIdents: true,
      },
    },
  },
};

What's Changed

New Features 🎉

Performance 🚀

Bug Fixes 🐞

Document 📖

Other Changes

Full Changelog: v2.0.4...v2.0.5

v2.0.4

Choose a tag to compare

@ahabhgk ahabhgk released this 20 May 12:49

Highlights 💡

  • Inline const with module declarations (#14032): Previously, Rspack only inlined constant exports from leaf modules in the module graph. Now constant exports from any module can be inlined, even when that module also imports or re-exports other modules. In rare circular-reference cases this can make a TDZ error disappear, but we do not expect real projects to rely on TDZ errors, so Rspack prioritizes the optimization.

    // constants.js
    import './setup';
    
    export const ENABLE_EXPERIMENT = false;
    
    // entry.js
    import { ENABLE_EXPERIMENT } from './constants';
    
    if (ENABLE_EXPERIMENT) {
      runExperiment();
    }
    
    // Before: constants.js is not a leaf module, so the branch could keep
    // reading the imported binding.
    if (ENABLE_EXPERIMENT) {
      runExperiment();
    }
    
    // Now: the constant can still be inlined, so dead branches are easier
    // to remove.
    if (false) {
      runExperiment();
    }
  • Tree shake namespace default reexport (#13980): Previously, the import * as a from './a'; export default a; pattern did not tree-shake a through the default export. Now Rspack further analyzes the default-exported namespace object and can remove unused exports from the original namespace module.

    // a.js
    export function used() {}
    export function unused() {}
    
    // bridge.js
    import * as a from './a';
    export default a;
    
    // app.js
    import a from './bridge';
    
    a.used();
    
    // Before: both used and unused could be kept in the bundle.
    // Now: unused can be tree-shaken.
  • CSS global module type (#13988): css/global is useful when most selectors in a stylesheet should stay global, but you still want CSS Modules features for selected local selectors. This makes it easier to migrate existing global CSS gradually without turning every class name into a local scoped name.

    export default {
      module: {
        rules: [{ test: /\.global\.css$/i, type: 'css/global' }],
      },
    };
    /* style.global.css */
    .button {
      color: red;
    }
    
    :local(.title) {
      font-weight: 600;
    }

    .button stays global, while .title is renamed as a local class.

  • CSS Modules local ident options (#14009): CSS Modules now support local ident hash options such as hash function, digest, digest length, and salt. These options make generated class names more configurable and better aligned with webpack-compatible CSS Modules setups.

    export default {
      module: {
        rules: [{ test: /\.module\.css$/i, type: 'css/module' }],
        generator: {
          'css/module': {
            localIdentName: '[name]__[local]__[hash]',
            localIdentHashFunction: 'xxhash64',
            localIdentHashDigest: 'hex',
            localIdentHashDigestLength: 8,
            localIdentHashSalt: 'my-salt',
          },
        },
      },
    };

What's Changed

New Features 🎉

Performance 🚀

Bug Fixes 🐞

  • fix(rsc): skip client entry mismatch without injections by @SyMind in #14018
  • fix(cli): write logger trace output to file by default by @hardfist in #14022
  • fix(ci): repair broken rustup shim chain on macos-latest by @stormslowly in #14040
  • fix(stats): preserve sub-millisecond precision in logger time entries by @stormslowly in #14049
  • fix: import.meta.filename/dirname escape on windows by @ahabhgk in #14050
  • fix(rsc): group client chunks by server-entry ownership by @SyMind in #13880
  • fix(rslib): emit type-only isolated dts dependencies by @Timeless0911 in #14037
  • fix(copy-plugin): support JS input file system for glob copies by @intellild in #14023
  • fix: keep buildHttp imports bundled for node target by @SyMind in #14086

Document 📖

Other Changes

Full Changelog: v2.0.3...v2.0.4

v2.0.3

Choose a tag to compare

@LingyuCoder LingyuCoder released this 12 May 10:51

What's Changed

Performance Improvements ⚡

New Features 🎉

  • feat: expose dependency import attributes by @hardfist in #13947
  • feat(rsc): support configurable CSS link props by @SyMind in #13945
  • feat(externals): add modern-module externals type by @JSerFeng in #13861
  • feat: support import.meta.rspackRsc by @SyMind in #13840
  • feat: drop inactive branch dependencies for inlined booleans by @JSerFeng in #13863
  • feat(sourcemap): support relative paths in inline source maps by @SyMind in #13974

Bug Fixes 🐞

Refactor 🔨

  • refactor(rstest): expose injectDynamicImportOrigin.functionName and resolve callee once by @fi3ework in #13930
  • refactor: use rspack util base64 by @intellild in #13978
  • refactor(core): remove unused exports final name metadata by @LingyuCoder in #14003

Document Updates 📖

Other Changes

Full Changelog: v2.0.2...v2.0.3

v2.0.2

Choose a tag to compare

@SyMind SyMind released this 06 May 13:43

What's Changed

Performance Improvements ⚡

New Features 🎉

Bug Fixes 🐞

  • fix: handle weak dynamic imports without async chunks by @hardfist in #13848
  • fix(source-maps): avoid loader request in lightningcss source maps by @zalishchuk in #13830
  • fix(rsc): handle server component css by server entry scope by @SyMind in #13844
  • fix: sort ConcatenatedModule export keys for deterministic builds by @mango766 in #13425
  • fix: use index maps for concatenated export rendering by @JSerFeng in #13875
  • fix(core): ignore optional hono type imports by @chenjiahan in #13883
  • fix(rsc): scope server-entry CSS collection by entry by @SyMind in #13878
  • fix(rslib): make isolated dts metadata relative by @Timeless0911 in #13884
  • fix(deps): update http-proxy-middleware to 4.0.0-beta.6 by @Darshan808 in #13909
  • fix(plugin-library): skip unused exports in ModuleLibraryPlugin by @SAY-5 in #13920
  • fix: expose numeric chunk ids in JS APIs by @JSerFeng in #13839
  • fix(rsc): support void onServerComponentChanges callbacks by @SyMind in #13885
  • fix: align module external remapping with webpack by @JSerFeng in #13802

Document Updates 📖

Other Changes

  • chore: move check source changed jobs to self-hosted runner by @hardfist in #13862
  • chore: release version 2.0.1 by @intellild in #13860
  • chore(benchmark): disable minimize for bundle codspeed by @LingyuCoder in #13871
  • chore(deps): update dependency happy-dom to ^20.9.0 by @renovate[bot] in #13833
  • chore(deps): update dependency toml to v4 by @renovate[bot] in #13892
  • chore(deps): update dependency image-minimizer-webpack-plugin to v5 by @renovate[bot] in #13891
  • chore(deps): update dependency lint-staged to ^16.4.0 by @renovate[bot] in #13887
  • chore(deps): update dependency @module-federation/runtime-tools to v2.4.0 by @renovate[bot] in #13886
  • chore(deps): update dependency cspell to v10 by @renovate[bot] in #13897
  • chore(deps): update dependency @shikijs/transformers to v4 by @renovate[bot] in #13896
  • chore(deps): update dependency mermaid to ^11.14.0 by @renovate[bot] in #13894
  • chore(deps): update dependency terser-webpack-plugin to ^5.5.0 by @renovate[bot] in #13889
  • chore(deps): update dependency ws to ^8.20.0 by @renovate[bot] in #13895
  • chore(deps): update patch npm dependencies by @renovate[bot] in #13900
  • build: replace webpack-merge with rspack-merge by @intellild in #13907
  • chore(deps): update rust crate rayon to 1.12.0 by @renovate[bot] in #13904
  • chore(deps): update rust crate oneshot to 0.2.1 by @renovate[bot] in #13903
  • chore(deps): update dependency exit-hook to v5 by @renovate[bot] in #13906
  • chore(deps): update yarn to v4.14.1 by @renovate[bot] in #13905
  • chore(deps): update dependency memfs to v4.57.2 by @renovate[bot] in #13888
  • chore(deps): update dependency watchpack to v2.5.1 by @renovate[bot] in #13890
  • chore(deps): update dependency axios to ^1.16.0 by @renovate[bot] in #13911
  • chore(deps): update rust crate hashlink to 0.11.0 by @renovate[bot] in #13912
  • chore(deps): update rust crate indexmap to 2.14.0 by @renovate[bot] in #13913
  • chore(deps): remove http-proxy-middleware dts patch by @chenjiahan in #13919
  • chore(deps): update dependency @discoveryjs/json-ext to v1 by @renovate[bot] in #13916
  • chore(deps): update napi by @renovate[bot] in #13899

New Contributors

Full Changelog: v2.0.1...v2.0.2

⌂ 换网址