Rsbuild 2.0 Released with New Features and Upcoming TanStack Start Support
Rsbuild 2.0 launches with Rspack 2.0 underpinnings, offering React Server Components, enhanced dev‑server communication, custom logging, lighter default dependencies, safer localhost defaults, modern ESM output, updated browser targets, and a migration path for existing projects, while announcing future integration with TanStack Start.
Major improvements in Rsbuild 2.0
New features
Upgrade to Rspack 2.0
Support for React Server Components (RSC)
Development server and client communication APIs
Extended built‑in server via server.setup Custom customLogger option
Easier splitChunks configuration
Updated create‑rsbuild templates
Lighter
Default dependencies reduced from 13 to 4, shrinking install size by ~2 MB
Safer
Default server.host changed from '0.0.0.0' to 'localhost' Proxy middleware upgraded to support HTTP/2 and address known security issues
More modern
Published as a pure ESM package, removing the CommonJS build
Node.js 18 no longer supported; minimum Node.js version is 20.19+ or 22.12+
Default browserslist targets the Baseline set for 2025‑05‑01 (Chrome 87→107, Edge 88→107, Firefox 78→104, Safari 14→16)
Node.js output defaults to uncompressed ES modules
Decorator version defaults to 2023‑11 (previously 2022‑03)
React Server Components support
React Server Components (RSC) pre‑render components on the server, combining data fetching with component logic and reducing client‑side JavaScript. Rsbuild provides the rsbuild-plugin-rsc plugin (see https://github.com/rstackjs/rsbuild-plugin-rsc) which leverages Rspack’s built‑in RSC capability and the Rsbuild Environments API (https://rsbuild.rs/zh/guide/advanced/environments) to unify client and server environments.
import { defineConfig } from '@rsbuild/core';
import { pluginReact } from '@rsbuild/plugin-react';
import { pluginRSC } from 'rsbuild-plugin-rsc';
export default defineConfig({
plugins: [pluginReact(), pluginRSC({ /* Plugin options */ })],
environments: {
server: { /* Server config... */ },
client: { /* Client config... */ },
},
});The plugin is experimental but already runs the RSC example in React Router (https://github.com/rstackjs/rsbuild-plugin-rsc/tree/main/examples/react-router) and is used in the Modern.js framework (https://modernjs.dev/guides/basic-features/render/rsc).
Collaboration with the TanStack team is underway to add support for TanStack Start (https://tanstack.com/start) and TanStack’s RSC (https://tanstack.com/blog/react-server-components).
Development server and client communication
Some scenarios require the development server to actively notify the client after completing server‑side operations. Rsbuild 2.0 provides two communication APIs:
Server can send messages to the matching client via hot.send (see https://rsbuild.rs/zh/api/javascript-api/environment-api#hotsend)
Client can listen to custom events via import.meta.webpackHot.on These APIs reuse the existing HMR channel, avoiding extra WebSocket connections and limiting messages to the matching environment.
Example – server sends a message:
// rsbuild.config.ts
server.environments.web.hot.send('data-change', { count: 1 });Client listens for the message:
if (import.meta.webpackHot) {
import.meta.webpackHot.on('data-change', ({ count }) => {
console.log('data updated:', count);
});
}Extended built‑in server
The new server.setup option (https://rsbuild.rs/zh/config/server/setup) runs initialization logic when the development or preview server starts. It supersedes server.setupMiddlewares and allows registration of middleware, pre‑start tasks, or mode‑specific logic directly in the Rsbuild configuration.
// rsbuild.config.ts
export default {
server: {
setup({ server }) {
server.middlewares.use((req, res, next) => {
if (req.url === '/api/health') {
res.end('ok');
return;
}
next();
});
},
},
};Custom logger
The customLogger option (https://rsbuild.rs/zh/config/custom-logger) lets you define separate logger instances for multiple Rsbuild builds, customizing log levels, prefixes, or integrating external logging systems without affecting the global logger.
import { createLogger, defineConfig } from '@rsbuild/core';
const customLogger = createLogger({
level: 'warn',
prefix: '[web]',
});
export default defineConfig({
customLogger,
});See the logging guide for more details: https://rsbuild.rs/zh/guide/advanced/logging
Easier splitChunks configuration
In Rsbuild 1.x, performance.chunkSplit wrapped common split strategies but differed significantly from Rspack’s splitChunks, requiring developers to understand additional concepts such as strategy and forceSplitting. Rsbuild 2.0 introduces a new splitChunks option that aligns directly with Rspack’s behavior and supports preset configurations.
Example – using the per-package preset to split each package into its own chunk:
// rsbuild.config.ts
export default {
splitChunks: {
preset: 'per-package',
chunks: 'all',
},
};performance.chunkSplit is deprecated in 2.0 but existing configurations remain functional. Migration guidance: https://rsbuild.rs/zh/guide/upgrade/v1-to-v2#migration-performancechunksplit
Template updates in create‑rsbuild
The templates now generate an AGENTS.md file and support installing rsbuild‑best‑practices agents (https://github.com/rstackjs/agent-skills?tab=readme-ov-file#rsbuild-skills). When creating a React project, you can optionally choose the React Compiler (https://rsbuild.rs/zh/guide/framework/react#react-compiler). Experimental support for Rslint (https://github.com/web-infra-dev/rslint), a high‑performance TypeScript‑based linter, is added. Outdated React 18 and Vue 2 templates have been removed.
Dependency reduction
Default dependencies have been trimmed from 13 to 4, reducing the install size by about 2 MB. The following packages are no longer installed by default: core-js – install manually via output.polyfill if needed (https://www.npmjs.com/package/core-js) @module-federation/runtime-tools – required only when using moduleFederation.options (https://www.npmjs.com/package/@module-federation/runtime-tools) webpack-bundle-analyzer – recommend using Rsdoctor (https://rsbuild.rs/zh/guide/debug/rsdoctor) for bundle analysis
Default host change
The default value of server.host is now 'localhost' instead of '0.0.0.0', limiting exposure to the local machine. To enable network access, explicitly set the host in the config or use the --host CLI flag.
// rsbuild.config.ts
export default {
server: { host: '0.0.0.0' },
};
// CLI
rsbuild --hostProxy middleware upgrade
The development server’s proxy middleware has been upgraded from http-proxy-middleware v2 to v4, switching the underlying dependency from the unmaintained http-proxy to the actively maintained httpxy (https://npmx.dev/package/httpxy) maintained by the unjs community. This brings HTTP/2 support, resolves known security issues, and removes reliance on the deprecated url.parse() API.
Some fields of server.proxy have changed; see the upgrade guide: https://rsbuild.rs/zh/guide/upgrade/v1-to-v2#proxy
Pure ESM package
@rsbuild/coreis now published as a pure ESM package, removing the CommonJS build and reducing package size by about 500 KB. In Node.js 20+ the native require(esm) loader handles ESM modules, so most projects require no code changes (https://nodejs.org/api/modules.html#loading-ecmascript-modules-using-require).
Node.js support
Rsbuild 2.0 requires Node.js 20.19+ or 22.12+. Node.js 18 reached end‑of‑life in April 2025 and is no longer supported.
Support for a Node.js version is typically dropped about one year after its EOL to give the community ample upgrade time.
Default target environment update
For web output, the default browserslist now follows the Baseline set for 2025‑05‑01 (https://web-platform-dx.github.io/web-features/), covering Chrome 107, Edge 107, Firefox 104, and Safari 16. This results in modern JavaScript and CSS output with fewer polyfills. For Node.js output, the default target version has been raised from Node 16 to Node 20.
If you have explicitly configured .browserslistrc, package.json#browserslist, or output.overrideBrowserslist, those settings take precedence.
ESM Node.js output
When building for Node.js, Rsbuild 2.0 now outputs uncompressed ES modules by default, preserving clear stack traces and aligning with modern Node practices. To retain the previous compressed CommonJS output, set output.module to false and enable minification.
// rsbuild.config.ts
export default {
output: {
target: 'node',
module: false,
minify: true,
},
};Decorator version update
With SWC support for the 2023‑11 decorator proposal, the default decorators.version has been updated from 2022‑03 to 2023‑11 (https://rsbuild.rs/zh/config/source/decorators#decoratorsversion). To keep the old behavior, explicitly set the version:
// rsbuild.config.ts
export default {
source: {
decorators: { version: '2022-03' },
},
};Upgrading to Rsbuild 2.0
For most projects, upgrading to Rsbuild 2.0 is a smooth process. Although 2.0 introduces default behavior changes and some incompatibilities, clear migration paths are provided and most changes require no code modifications. If you use a coding agent with skills support, you can install the rsbuild‑v2‑upgrade skill to automate dependency upgrades, configuration adjustments, and migration checks.
npx skills add rstackjs/agent-skills --skill rsbuild-v2-upgradeFull upgrade guide and incompatibility details: https://rsbuild.rs/zh/guide/upgrade/v1-to-v2
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.
