web-infra-dev/rspack
 Watch   
 Star   
 Fork   
2 days ago
rspack

v2.0.6

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 🐞

Document 📖

Other Changes

Full Changelog: https://github.com/web-infra-dev/rspack/compare/v2.0.5...v2.0.6

7 days ago
rspack

v2.0.5

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: https://github.com/web-infra-dev/rspack/compare/v2.0.4...v2.0.5

15 days ago
rspack

v2.0.4

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 🐞

Document 📖

Other Changes

Full Changelog: https://github.com/web-infra-dev/rspack/compare/v2.0.3...v2.0.4

23 days ago
rspack

v2.0.3

What's Changed

Performance Improvements ⚡

New Features 🎉

Bug Fixes 🐞

Refactor 🔨

Document Updates 📖

Other Changes

Full Changelog: https://github.com/web-infra-dev/rspack/compare/v2.0.2...v2.0.3

29 days ago
rspack

v2.0.2

What's Changed

Performance Improvements ⚡

New Features 🎉

Bug Fixes 🐞

Document Updates 📖

Other Changes

New Contributors

Full Changelog: https://github.com/web-infra-dev/rspack/compare/v2.0.1...v2.0.2

2026-04-28 18:32:26
rspack

v2.0.1

What's Changed

Performance Improvements ⚡

New Features 🎉

Bug Fixes 🐞

Refactor 🔨

Document Updates 📖

Other Changes

New Contributors

Full Changelog: https://github.com/web-infra-dev/rspack/compare/v2.0.0...v2.0.1

2026-04-22 13:03:18
rspack

v2.0.0

⚡️ Rspack 2.0 Released! ⚡️


What's Changed

Breaking Changes 🛠

Performance Improvements ⚡

New Features 🎉

Bug Fixes 🐞

Refactor 🔨

Document Updates 📖

Other Changes

New Contributors

Full Changelog: https://github.com/web-infra-dev/rspack/compare/v1.7.11...v2.0.0

2026-04-17 11:16:10
rspack

v2.0.0-rc.3

What's Changed

New Features 🎉

Bug Fixes 🐞

Refactor 🔨

Document Updates 📖

Other Changes

Full Changelog: https://github.com/web-infra-dev/rspack/compare/v2.0.0-rc.2...v2.0.0-rc.3

2026-04-14 18:46:36
rspack

v2.0.0-rc.2

What's Changed

Performance Improvements ⚡

New Features 🎉

Bug Fixes 🐞

Refactor 🔨

Document Updates 📖

Other Changes

New Contributors

Full Changelog: https://github.com/web-infra-dev/rspack/compare/v2.0.0-rc.1...v2.0.0-rc.2

2026-04-08 14:21:27
rspack

v2.0.0-rc.1

Highlights 💡

Better tree shaking with side-effect-free function analysis

Rspack can now detect side-effect-free function calls through the #__NO_SIDE_EFFECTS__ notation and manual pureFunctions hints. With support for exported functions and cross-module analysis, unused calls can be identified more reliably, improving tree shaking results and making it easier to optimize both application code and third-party dependencies.

// 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

Breaking Changes 🛠

Performance Improvements ⚡

New Features 🎉

Bug Fixes 🐞

Refactor 🔨

Document Updates 📖

Other Changes

New Contributors

Full Changelog: https://github.com/web-infra-dev/rspack/compare/v2.0.0-rc.0...v2.0.0-rc.1