Skip to content

Releases: web-infra-dev/rspack

v1.6.5

25 Nov 09:11

Choose a tag to compare

What's Changed

New Features πŸŽ‰

Bug Fixes 🐞

Refactor πŸ”¨

  • refactor: processing more string concatenation in runtime template part 2 by @LingyuCoder in #12235
  • refactor: rename webpack imported vars to rspack format by @chenjiahan in #12245
  • refactor: rename webpack external vars to rspack format by @chenjiahan in #12249
  • refactor: rename webpack default export var to rspack format by @chenjiahan in #12257
  • refactor: rename webpack reexport vars to Rspack format by @chenjiahan in #12263
  • refactor: use chunk id as the placeholder when calculating content-hash by @JSerFeng in #12271
  • refactor: render runtime globals by runtime template by @LingyuCoder in #12272

Document Updates πŸ“–

Other Changes

Full Changelog: v1.6.4...v1.6.5

v1.6.4

18 Nov 11:13
54dd4bb

Choose a tag to compare

What's Changed

New Features πŸŽ‰

  • feat: support arrow function in on_chunks_loaded callback by @chenjiahan in #12193
  • feat(rslib): handle hashbang / react directives natively by @fi3ework in #12168

Bug Fixes 🐞

Refactor πŸ”¨

  • refactor: move code splitting cache into artifact by @hardfist in #12164
  • refactor: split make phase by @hardfist in #12186
  • refactor: split module_graph into ModuleGraphRef and ModuleGraphMut by @hardfist in #12199
  • refactor: processing more string concatenation in runtime template part 1 by @LingyuCoder in #12225

Document Updates πŸ“–

Other Changes

Full Changelog: v1.6.3...v1.6.4

v1.6.3

13 Nov 07:31

Choose a tag to compare

What's Changed

New Features πŸŽ‰

  • feat: export ErrorData from rspack_error crate by @ityuany in #12166

Bug Fixes 🐞

Document Updates πŸ“–

  • docs(split-chunks): update module federation compatibility note by @chenjiahan in #12178

Other Changes

Full Changelog: v1.6.2...v1.6.3

v1.6.2

12 Nov 14:09

Choose a tag to compare

What's Changed

Performance Improvements ⚑

New Features πŸŽ‰

Bug Fixes 🐞

Refactor πŸ”¨

Other Changes

Full Changelog: v1.6.1...v1.6.2

v1.6.1

05 Nov 12:00
874e9fd

Choose a tag to compare

What's Changed

Highlights πŸ’‘

In Rspack 1.6.1, the source map implementation in the rspack-sources crate has been optimized, improving source map generation performance by roughly 30%.

image

Performance Improvements ⚑

Bug Fixes 🐞

Refactor πŸ”¨

  • refactor: import external should not create needless external module by @JSerFeng in #12064

Document Updates πŸ“–

  • docs: add 1.6.0 release blog by @JSerFeng in #12019
  • docs: improve English clarity in documentation by @Copilot in #12060
  • docs: move deprecated experimental options to the bottom by @chenjiahan in #12049
  • docs(quick-start): update non-interactive mode section by @chenjiahan in #12083

Other Changes

Full Changelog: v1.6.0...v1.6.1

v1.6.0

30 Oct 11:05

Choose a tag to compare

πŸŽ‰ See Announcing Rspack 1.6 for more details.

What's Changed

Performance Improvements ⚑

New Features πŸŽ‰

Bug Fixes 🐞

  • fix(loader-runner): add missing break statements in switch cases by @chenjiahan in #11794
  • fix: revert "fix: remove serde feature of lightningcss (#11706)" by @colinaaa in #11796
  • fix: correct stats.color type to include fine-grained options by @chenjiahan in #11797
  • fix: export interop default symbol and ensure import required chunks by @JSerFeng in #11793
  • fix: should re-export real exportInfo when export dynamic js by @JSerFeng in #11776
  • fix: should process runtime chunk after normal chunks of same chunk group by @LingyuCoder in #11778
  • fix: should use external source as name hint by @JSerFeng in #11825
  • fix(swc_plugin_import): fix panic and optimize diagnostic logs by @chenjiahan in #11862
  • fix: distinguish external modules when there are import attributes by @fi3ework in #11845
  • fix: should render default exports for cjs entry and json entry by @JSerFeng in #11860
  • fix: should export from entry chunk for cjs reexport default by @JSerFeng in #11884
  • fix: should not cache dependency instance in DynamicEntryPlugin by @SyMind in #11888
  • fix: updated dependencies sync to persistent cache by @jerrykingxyz in #11910
  • fix: no need to create compiler instance when closing compiler by @chenjiahan in #11923
  • fix: should allow override can_inline_use in flag dependency usage plugin by @ahabhgk in #11934
  • fix: perf regression caused by is_deferred by @ahabhgk in #11944
  • fix(create-rspack): polish README and configurations by @chenjiahan in #11953
  • fix(mf): federation modules plugin hooks leak by @quininer in #11929
  • fix(swcLoader): should correctly generate the default value of env_na… by @Zeahan in #11906
  • fix(types): add createReadStream to OutputFileSystem interface by @chenjiahan in #11963
  • fix: improve type safety for MultiStats options by @chenjiahan in #11964
  • fix: should support entries() for compilation.chunks by @SyMind in #11971
  • fix: esm output chunk module missing load dependent chunks by @stormslowly in #11945
  • fix: inline value for multiple runtime by @ahabhgk in #11983
  • fix: unknown defined properties for exported enum by @ahabhgk in #11992
  • fix: compilation.*_dep.added should not contains updated files by @jerrykingxyz in #11991
  • fix: side effects optimize panic when remove lib file by @jerrykingxyz in #11939
  • fix: should only top-level require wrapped modules for import side-effect specifier by @JSerFeng in #11997
  • fix: use asset resource module as entry by @LingyuCoder in #11993
  • fix: Remove some unnecessary unsafe by @quininer in #12006
  • fix: type definitions for devtool module filename templates by @chenjiahan in #12013
  • fix: incremental wrong provided exports results caused panic when delete module by @ahabhgk in #12009
  • fix: rayon iterator.consume will block in WASM by @jerrykingxyz in #12022
  • fix: calculate side effects of call exprs in seq expr by @LingyuCoder in #12017
  • fix: should remove related correctly in compilation.updateAsset by @LingyuCoder in #12031
  • fix: should resplace resource query in context replacement plugin by @LingyuCoder in #12033
  • fix(wasm): add another SharedArrayBuffer instance check by @CPunisher in #12037

Refactor πŸ”¨

  • refactor: update type definitions to fix Rslint issues by @chenjiahan in #11798
  • refactor: remove experiments.layers by @JSerFeng in #11819
  • refactor: output.charset false by default by @JSerFeng in #11837
  • refactor: make artifact collect affected dependencies by @jerrykingxyz in #11905
  • refactor: clean up default stats plugins by @chenjiahan in #11904
  • refactor: consolidate ModuleError and ModuleWarning classes by @chenjiahan in #11935
  • refactor(watcher): split watcher from rspack_fs by @h-a-n-a in #11948
  • refactor(core): Convert BoxModule from type alias to newtype struct by @kdy1 in http...
Read more

v1.6.0-beta.1

22 Oct 08:44

Choose a tag to compare

What's Changed

Highlights πŸ’‘

EsmLibraryPlugin supports preserveModules

EsmLibraryPlugin now provides experimental support for the preserveModules feature. This allows you to maintain your source code structure as is while bundling all libraries within the node_modules folder. You can try it out using the following configuration example:

Feel free to copy and use it!

import { rspack } from "@rspack/core";
import path from 'node:path'

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({
      preserveModules: path.resolve(__dirname, './src')
    })
  ],
};

Experimental supports for defer import

Rspack now supports defer import, you can enable it by experiments.deferImport = true. It is worth noting that we currently only support import defer, import.defer() will be implemented in the near future.

export default {
  experiments: {
    deferImport: true
  }
}

Performance Improvements ⚑

New Features πŸŽ‰

Bug Fixes 🐞

  • fix: should export from entry chunk for cjs reexport default by @JSerFeng in #11884
  • fix: should not cache dependency instance in DynamicEntryPlugin by @SyMind in #11888
  • fix: updated dependencies sync to persistent cache by @jerrykingxyz in #11910
  • fix: no need to create compiler instance when closing compiler by @chenjiahan in #11923
  • fix: should allow override can_inline_use in flag dependency usage plugin by @ahabhgk in #11934
  • fix: perf regression caused by is_deferred by @ahabhgk in #11944

Refactor πŸ”¨

Document Updates πŸ“–

Other Changes

New Contributors

Full Changelog: v1.6.0-beta.0...v1.6.0-beta.1

v1.6.0-beta.0

15 Oct 07:46
0a101e2

Choose a tag to compare

πŸ§ͺ 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 ⚑

  • perf(browser): minor performance optimization for @rspack/browser by @CPunisher in #11795
  • perf(swc_plugin_import): replace handlebars with custom template engine by @chenjiahan in #11852

New Features πŸŽ‰

Bug Fixes 🐞

  • fix(loader-runner): add missing break statements in switch cases by @chenjiahan in #11794
  • fix: revert "fix: remove serde feature of lightningcss (#11706)" by @colinaaa in #11796
  • fix: correct stats.color type to include fine-grained options by @chenjiahan in #11797
  • fix: export interop default symbol and ensure import required chunks by @JSerFeng in #11793
  • fix: should re-export real exportInfo when export dynamic js by @JSerFeng in #11776
  • fix: should process runtime chunk after normal chunks of same chunk group by @LingyuCoder in #11778
  • fix: should use external source as name hint by @JSerFeng in #11825
  • fix(swc_plugin_import): fix panic and optimize diagnostic logs by @chenjiahan in #11862
  • fix: distinguish external modules when there are import attributes by @fi3ework in #11845
  • fix: should render default exports for cjs entry and json entry by @JSerFeng in #11860

Refactor πŸ”¨

Document Updates πŸ“–

  • docs: improve documentation for stats properties by @chenjiahan in #11792
  • docs: explain how resolve.alias affects package resolution by @SyMind in #11799
  • docs(browser): add usage of useInputFileSystem to "In-Memory File system" section by @CPunisher in #11833
  • docs(browser): Add compatibility with resolve.alias description for BrowserHttpImportEsmPlugin by @CPunisher in #11838

Other Changes

Read more

v1.5.8

29 Sep 08:42

Choose a tag to compare

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 🐞

  • fix: cjs export require tree shaking by @ahabhgk in #11758
  • fix: should always walk import then arguments by @ahabhgk in #11760
  • fix: should update alias resolution when a higher-priority file is created in watch mode by @SyMind in #11643
  • fix: should analyze correct variable for dynamic import by @ahabhgk in #11768
  • fix: URLPlugin in child compiler by @SyMind in #11785

Refactor πŸ”¨

Document Updates πŸ“–

Other Changes

New Contributors

Full Changelog: v1.5.7...v1.5.8

v1.5.7

24 Sep 07:15

Choose a tag to compare

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 πŸŽ‰

  • feat: static analyze destructuring assignment dynamic import variable for tree shaking by @ahabhgk in #11731
  • feat: parser support jsx by @fi3ework in #11664

Bug Fixes 🐞

Document Updates πŸ“–

Other Changes

Full Changelog: v1.5.6...v1.5.7