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

v1.6.0-beta.0

🧪 Enhanced ESM library output (experimental)

Rspack now provides a new ESM library output that is cleaner, statically analyzable, and supports custom chunk splitting.

This new output format is fully independent of the existing chunk loading logic — each chunk can be used in isolation, and all exports are placed at the top level instead of being wrapped inside the __webpack_modules__ closure.

  • Before:
exports.modules = { 
  "src/async-module.js": function(exports) {
    __webpack_require__.d(exports, {
      foo: () => foo
    })
    const foo = 42
  }
}
  • After:
// src/async-module.js
const foo = 42

export { foo }

If you'd like to try this now, follow this example:

import { rspack } from "@rspack/core";

export default{
  entry: "./index.js",
  output: {
    chunkFormat: false,  // required, EsmLibraryPlugin handles how chunk renders 
    chunkLoading: 'import',  // required, using es module dynamic import syntax to load other chunks
  },
  optimization: {
    runtimeChunk: true,  // recommended if you have async chunks
    concatenateModules: false,  // required, EsmLibraryPlugin handles scope hoisting
  },
  plugins: [new rspack.experiments.EsmLibraryPlugin()],
};

We'll make this out-of-box in Rslib soon.

See EsmLibraryPlugin for more.

🎯 Layers is now stable

The layer feature is now enabled by default - you no longer need to enable it manually using the experiments.layer option.

Layers is a feature that helps you group certain modules and their dependencies, allowing you to bundle them using different transforms.

For example, you can generate both ES5 and ES2015 outputs in one compilation by assigning different layers to different entries with the following configuration:

export default {
  entry: {
    legacy: {
      import: "./index.js",
      layer: "es5",
    },
    modern: {
      import: "./index.js",
      layer: "es6",
    },
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        oneOf: [
          {
            issuerLayer: "es5",
            use: [
              {
                loader: "builtin:swc-loader",
                options: {
                  jsc: {
                    target: "es5",
                    // ...
                  },
                },
              },
            ],
          },
          {
            issuerLayer: "es6",
            use: [
              {
                loader: "builtin:swc-loader",
                options: {
                  jsc: {
                    target: "es2015",
                    // ...
                  },
                },
              },
            ]
          },
        ],
      },
    ],
  },
};

📄 Extract existing source maps

Rspack now supports extracting existing source map data from files (from their //# sourceMappingURL comment) via Rule.extractSourceMap. This feature is particularly useful for preserving source maps provided by third-party libraries, ensuring that debugging information remains accurate even when those libraries are bundled or transformed.

It was originally introduced in webpack v5.102.0 as a built-in replacement for the source-map-loader plugin, offering better performance and tighter integration with the build process.

export default {
  // ...
  module: {
    rules: [
      {
        test: /\.m?js$/,
        extractSourceMap: true,
      },
    ],
  },
};

✅ Lazy barrel enabled by default

Since Rspack v1.5 introduced experimental barrel file optimization, it has been enabled by default in Rsbuild to collect early feedback.

After extensive usage and validation within Rsbuild, we now consider lazyBarrel stable, and it is enabled by default in Rspack as well.

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/v1.5.8...v1.6.0-beta.0

20 days ago
rspack

v1.5.8

Highlights 💡

Enhanced Tree Shaking for Nested Exports in Destructuring

Rspack now supports more precise tree shaking for nested exports accessed through destructuring assignments.

// lib.js
export * as a from "./a";
export * as b from "./b";

// index.js
import * as lib from "./lib";
// Before: All exports under `lib.a` were retained, only `lib.b` was tree-shaken
// Now: Only the specific property `inner` from `lib.a` is kept; everything else is removed
const { a: { inner } } = lib;

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/v1.5.7...v1.5.8

25 days ago
rspack

v1.5.7

Highlights 💡

Improved Tree Shaking for Dynamic Import .then()

This release enhances tree shaking capabilities specifically for the .then() callbacks of dynamic imports. Rspack can now statically analyze and eliminate unused exports when destructuring is performed on the resolved module within promise chains:

// Tree shaking now works for destructuring in .then() callbacks
import('./utils').then(module => {
  const { usedFunction } = module; // Only usedFunction will be included
  usedFunction();
  // unusedFunction will be tree-shaken out
});

JSX Preserve Support

Rspack now supports parsing and preserving JSX syntax. This allows JSX syntax to be parsed without transformation, making it compatible with external JSX transformers.

// rspack.config.js
export default {
  module: {
    parser: {
      javascript: {
        jsx: true // Enable JSX parsing
      }
    },
    rules: [
      {
        test: /\.jsx?$/,
        use: {
          loader: 'swc-loader',
          options: {
            jsc: {
              parser: { jsx: true },
              transform: {
                // Preserve JSX syntax
                react: { runtime: 'preserve' }
              }
            }
          }
        }
      }
    ]
  }
};

What's Changed

New Features 🎉

Bug Fixes 🐞

Document Updates 📖

Other Changes

Full Changelog: https://github.com/web-infra-dev/rspack/compare/v1.5.6...v1.5.7

27 days ago
rspack

v1.5.6

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/v1.5.5...v1.5.6

2025-09-17 15:13:13
rspack

v1.5.5

What's Changed

Bug Fixes 🐞

Document Updates 📖

Other Changes

Full Changelog: https://github.com/web-infra-dev/rspack/compare/v1.5.4...v1.5.5

2025-09-15 21:58:23
rspack

v1.5.4

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/v1.5.3...v1.5.4

2025-09-10 07:39:29
rspack

v1.5.3

Highlights 💡

Advanced tree-shaking

Rspack v1.5.3 ships advanced tree-shaking for dynamic imports via member expression analysis.

Ongoing improvements are in progress, and upcoming releases will continue to improve static analysis to cover more syntax patterns, such as dynamic import with a subsequent .then().

image

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/v1.5.2...v1.5.3

2025-09-01 21:04:27
rspack

v1.5.2

What's Changed

Performance Improvements ⚡

New Features 🎉

Bug Fixes 🐞

Refactor 🔨

Document Updates 📖

Other Changes

Full Changelog: https://github.com/web-infra-dev/rspack/compare/v1.5.1...v1.5.2

2025-08-28 18:36:25
rspack

v1.5.1

What's Changed

Performance Improvements ⚡

Bug Fixes 🐞

Refactor 🔨

Document Updates 📖

Other Changes

Full Changelog: https://github.com/web-infra-dev/rspack/compare/v1.5.0...v1.5.1

2025-08-26 18:36:30
rspack

v1.5.0

rspack-banner-v1-5

🎉 See Announcing Rspack 1.5 for more details.

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.4.11...v1.5.0