What’s New in Rspack 1.6? Explore Enhanced Tree Shaking, Import Defer, and Faster Builds

Rspack 1.6 is officially released, bringing enhanced tree shaking for dynamic imports, native support for the import defer syntax, a new experimental EsmLibraryPlugin for cleaner ESM bundles, default barrel optimization, stable layer handling, JSX preservation, source‑map extraction, significant performance gains, and a host of updates across the Rstack ecosystem such as Rsbuild, Rspress, Rslib, Rstest and Rsdoctor.

ByteDance Web Infra
ByteDance Web Infra
ByteDance Web Infra
What’s New in Rspack 1.6? Explore Enhanced Tree Shaking, Import Defer, and Faster Builds

New Features

Enhanced Tree Shaking

Rspack 1.6 improves support for dynamic import tree shaking. Previously only destructuring assignments were analyzed; now a comprehensive static analysis can identify multiple usage patterns and precisely remove unused exports, reducing bundle size.

// Rspack 1.5 - only supports destructuring analysis
const { value } = await import('./module');
console.log(value);

// Rspack 1.6 - supports various cases
// Case 1
const mod = await import('./module');
const { value } = mod;
console.log(value);
// Case 2
const mod = await import('./module');
console.log(mod.value);
// Case 3
import('./module').then(({ value }) => {
  console.log(value);
});
// Case 4
import('./module').then(mod => {
  const { value } = mod;
  console.log(value);
});
// Case 5
import('./module').then(mod => {
  console.log(mod.value);
});

Support import defer

Rspack now supports the import defer syntax introduced in TypeScript 5.9, allowing modules to be imported without immediate execution. Enable it with experiments.deferImport in the config.

export default {
  experiments: {
    deferImport: true,
  },
};
Currently Rspack only supports the import defer syntax; the function form import.defer() will be added later.

Optimized ESM output

To improve ESM bundles, Rspack replaces module concatenation with the experimental EsmLibraryPlugin, which fully takes over the bundling process, removes runtime code, and supports code splitting.

Rspack 1.6 ESM output diff
Rspack 1.6 ESM output diff

Enable the plugin manually:

import { rspack } from '@rspack/core';
export default {
  plugins: [new rspack.experiments.EsmLibraryPlugin()],
  optimization: {
    runtimeChunk: true,
  },
};

Barrel optimization enabled by default

The experimental lazyBarrel feature is now stable and enabled by default, improving build performance for barrel files.

What is a barrel file? Barrel files re‑export other modules to simplify import paths and provide a unified API entry.

Stable layers feature

The experiments.layers option is deprecated; the layer feature can be used directly without the experimental switch.

Preserve JSX syntax

Rspack can keep JSX in the output, parsing it without transformation, which is useful for library builds that defer JSX conversion to downstream tools.

export default {
  module: {
    parser: {
      javascript: {
        jsx: true,
      },
    },
  },
  rules: [
    {
      test: /\.jsx?$/,
      use: {
        loader: 'builtin:swc-loader',
        options: {
          jsc: {
            parser: { jsx: true },
            transform: { react: { runtime: 'preserve' } },
          },
        },
      },
    },
  ],
};

Extract source map

Rspack can extract existing source‑map comments via Rule.extractSourceMap, providing a built‑in alternative to source-map-loader.

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

Performance improvements

CLI startup speed +50 ms

Build speed for 10 000 React components +11 %

Multiple UI component libraries build speed +31 % (thanks to default barrel optimization)

Data source: Rspack benchmark

Rstack Progress

Rsbuild 1.6

Forward browser logs

Browser errors are now automatically forwarded to the terminal. Disable with dev.browserLogs: false.

export default {
  dev: {
    browserLogs: false,
  },
};

Build ESM applications

Enable output.module: true to emit standard ESM scripts with type="module" script tags.

export default {
  output: {
    module: true,
  },
};

Faster config loading

Node.js 22 loads TypeScript configs natively; fallback to Jiti if needed. You can force a loader with rsbuild build --config-loader native or --config-loader jiti.

Rspress v2 beta

New theme preview

The new Rspress theme is in preview on the v2 site, offering a richer reading experience and more customization hooks.

rspress-v2-theme
rspress-v2-theme

PageTabs component

Rspress v2 adds a PageTabs component for splitting long content into sub‑pages.

Rspress 子页面切换组件
Rspress 子页面切换组件

Rslib 0.16

Faster type generation

Rslib now supports typescript-go for generating declaration files. Enable dts.tsgo: true to boost type‑checking performance by ~300 %.

export default {
  lib: [
    {
      dts: { tsgo: true },
    },
  ],
};

Preserve JSX

Set the React plugin runtime to 'preserve' to keep JSX unchanged in the output.

import { pluginReact } from '@rsbuild/plugin-react';
export default {
  lib: [{ bundle: false, format: 'esm' }],
  plugins: [
    pluginReact({
      swcReactOptions: { runtime: 'preserve' },
    }),
  ],
};

Rstest 0.6

VS Code extension

The Rstest VS Code extension allows discovering, running, and debugging tests directly in the editor.

Coverage support

Rstest now integrates with Istanbul to collect coverage reports.

rstest-coverage
rstest-coverage

Rsdoctor 1.3

GitHub Actions

Rsdoctor provides a GitHub bundle‑diff action to detect bundle size changes in CI.

Rsdoctor GitHub Actions
Rsdoctor GitHub Actions

Single JSON report & Playground

In brief mode Rsdoctor can export a single JSON report, which can be uploaded to the Playground page for visual analysis.

Ecosystem

next‑rspack

next‑rspack integrates a custom Rust binding into Next.js 16, delivering 24 % build‑time and 10 % dev‑time improvements.

Tool

Build time (no cache)

Dev time (no cache)

Rspack ([email protected])

3.8s

1.7s

Rspack ([email protected])

5.0s

1.9s

webpack

14.0s

7.8s

Benchmarks are based on the chakra‑ui‑docs repository; full data is in PERF.md.

Upgrade Guide

Upgrade SWC plugins

If you use SWC Wasm plugins (e.g., @swc/plugin-emotion), upgrade them to be compatible with swc_core@46 to avoid build errors.

Remove experiments.layer

The experiments.layer option is deprecated; simply delete it from the config.

export default {
  // experiments: { layer: true },
};
PerformanceRspackreleaseTree ShakingESM optimizationfrontend bundlerimport defer
ByteDance Web Infra
Written by

ByteDance Web Infra

ByteDance Web Infra team, focused on delivering excellent technical solutions, building an open tech ecosystem, and advancing front-end technology within the company and the industry | The best way to predict the future is to create it

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.