Rspack 2.0 Released – Up to 10× Faster Builds, New ESM Support and RSC
Rspack 2.0 launches with up to 10 × build speed gains over version 1.0, refined default APIs, pure‑ESM packages, enhanced tree‑shaking, React Server Components support, simplified target configuration, hash‑based module IDs and improved code‑splitting, while maintaining webpack compatibility and expanding ecosystem integrations.
Release Overview
Rspack 2.0 is released as the next step after the 1.x series, which already achieved a ten‑fold build‑performance boost while staying compatible with the webpack 5 API.
Progress from 1.x
Version 1.x introduced incremental builds, on‑demand compilation, persistent caching, constant inlining, virtual modules and barrel‑file optimizations. Weekly downloads grew from 100 k to 5 M.
Key Goals for 2.0
Maintain webpack compatibility while adopting modern JavaScript defaults, reducing breaking changes, and providing migration guides and Agent Skills to ease upgrades.
2.0 Highlights
Performance
Overall build speed ~10 % faster than 1.7 and up to 100 % faster than 1.0.
With persistent cache, production build time drops to 1.4 s (vs 5.6 s) and memory usage improves >20 %.
Product Optimization
Static analysis now covers CommonJS require destructuring, member access, and dynamic import() usage, expanding the tree‑shaking surface.
Compiler annotation #__NO_SIDE_EFFECTS__ enables removal of pure‑function calls whose return values are unused.
Module‑federation shared now supports treeShaking to trim unused exports.
Improved ESM Support
Core packages ( @rspack/core, @rspack/cli, @rspack/dev-server, @rspack/plugin-react-refresh) are published as pure ESM. import.meta is preserved in output; the module.parser.javascript.importMeta option can be set to 'preserve-unknown' to keep unknown properties.
Additional meta properties ( import.meta.main, import.meta.filename, import.meta.dirname) are supported.
New Features
React Server Components (RSC) support with "use client" / "use server" directives, compile‑time checks, CSS handling and HMR.
Sub‑path alias imports via #/ using the imports field in package.json.
Simplified target configuration – a single top‑level target drives loaders and minifiers.
Automatic syntax detection in builtin:swc-loader via detectSyntax: 'auto'.
Configurable CSS import resolution with resolveImport (boolean or function).
Hash‑based module IDs ( optimization.moduleIds = 'hashed') for stable, short IDs.
Enforced code‑splitting size threshold ( splitChunks.enforceSizeThreshold) defaults to 50 KB in production.
Performance Benchmarks
Rspack 1.0 – Prod build (no cache): 5.6 s; Prod build (cache): 5.6 s; Hot update: 128 ms.
Rspack 1.7 – Prod build (no cache): 3.6 s; Prod build (cache): 2.2 s; Hot update: 134 ms.
Rspack 2.0 – Prod build (no cache): 3.1 s; Prod build (cache): 1.4 s; Hot update: 118 ms.
Data source: rspack-react-10k-benchmark (GitHub actions run).
Dependency Reduction
@rspack/dev-serverdependencies reduced from 192 to 1. @rspack/core dependencies reduced from 8 to 1. @rspack/cli now has zero dependencies.
Legacy webpack-dev-server indirect dependencies removed, shrinking install size from 15 MB to 1.4 MB.
Compiler Annotation Example
// utils.js
/*#__NO_SIDE_EFFECTS__*/
export function join(a, b) {
return `${a}-${b}`;
} // index.js
import { join } from './utils';
join('btn', 'primary');When the return value of join is unused, the call is eliminated during tree shaking.
Import Defer Support
// app.js
const file = Math.random() > 0.5 ? 'a.js' : 'b.js';
import.defer('./dir' + file);Enable with experiments.deferImport: true in the configuration.
Sub‑Path Alias Import
// package.json
{
"imports": {
"#/*": "./src/*"
}
} // src/index.js
import main from '#/main.ts';Getting Started
Create a new Rsbuild project (Rsbuild is powered by Rspack): npm create rsbuild@latest Upgrade an existing project using the official migration guide (GitHub) or the Coding Agent skill:
npx skills add rstackjs/agent-skills --skill rspack-v2-upgradeFuture Roadmap
Product Optimization – deeper tree shaking, finer‑grained code splitting, static‑type‑aware optimizations.
Agent Friendly – richer CLI diagnostics and performance data for AI agents.
Toolchain Collaboration – tighter integration with Rsdoctor, Rslint, and the upcoming ts-checker-rspack-plugin for type checking.
Full roadmap: https://rspack.rs/zh/misc/planning/roadmap
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
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
