Rsbuild 2.0: Faster bundling, ESM-first and Node 20

Rsbuild 2.0 relies on Rspack 2.0, modernizes defaults (ESM-first, Node 20) and reduces dependencies. New APIs enhance communication.

listen Print view
Abstract lines forming a blue planet

(Image: bombermoon/Shutterstock.com)

5 min. read
Contents

Rsbuild 2.0 is here: The major release of the build tool relies on Rspack 2.0, modernizes numerous defaults – including towards ESM-first and Node 20 – and significantly reduces the number of dependencies. New APIs expand communication between the dev server and the client. At the same time, the version breaks with several legacy issues: CommonJS builds and a few Webpack dependencies are removed.

Rsbuild is a build tooling layer based on the Rust-based bundler Rspack and part of the Rstack ecosystem. This includes Rspress, Rslib, and Rstest, among others, which share a common build and plugin architecture.

At the core of Rsbuild 2.0 is the upgrade to Rspack 2.0. Projects benefit from faster bundling and new optimization possibilities. Rspack follows a webpack-compatible approach but is significantly faster due to its Rust implementation.

In parallel, Rsbuild is modernizing its technical foundation. The core package is now only available as an ES module; a CommonJS build is omitted. Target platforms are increasing: For Node.js, version 20 is now the standard, and browser targets are based on a baseline from May 2025. This reduces the need for transpiling and polyfills, leading to smaller bundles. For Node targets, Rsbuild also generates unminified ES modules by default – stack traces remain more readable this way.

Experimental support for React Server Components (RSC) is new. The rsbuild-plugin-rsc plugin integrates server-side rendered components that combine data fetching and rendering, thus sending less JavaScript to the client. It builds on native Rspack support and uses Rsbuild's Environments API to manage client and server contexts together. The Modern.js framework already uses the plugin; integration with TanStack Start is planned.

As part of this work, Rsbuild is expanding communication between the dev server and the browser. The existing HMR channel can now be used to exchange specific messages: the server sends an event via hot.send, which the client receives via import.meta.webpackHot.on. This allows, for example, a server-side process to trigger a targeted update on the client without reloading the entire page. An additional WebSocket is not necessary for this.

Videos by heise

Server configuration is also gaining flexibility. The new server.setup option allows initialization logic, middleware, or custom endpoints to be defined directly in the Rsbuild configuration – for both the dev and preview servers. The previous setupMiddlewares is retained for now but is considered deprecated.

For code splitting, Rsbuild is introducing a new splitChunks model, which complements and is intended to eventually replace the previous performance.chunkSplit option. The configuration now directly aligns with Rspack and offers predefined presets, for example, to split each npm package into its own chunk.

Several changes are also being made to security defaults: The dev server now listens only on localhost by default instead of all interfaces. This prevents development servers from being unintentionally accessible on the local network. Additionally, the proxy middleware is being updated to a new version that supports HTTP/2 and closes known security vulnerabilities.

Dependencies are shrinking significantly. Packages like core-js for polyfills or the Module Federation runtime are no longer part of the standard installation. According to the project, the number of included dependencies is dropping from 13 to 4.

Furthermore, Rsbuild now supports custom loggers per instance. This allows for finer control over log levels and output formats without altering the global logger. Project templates have also been revised: New projects can optionally use the React Compiler, and a linter based on TypeScript-Go is available experimentally. Templates for React 18 and Vue 2 in create-rsbuild have been removed by the team.

Version 2.0 comes with several breaking changes. In addition to the removal of Node 18 and CommonJS, the project is removing all Webpack-specific components and changing various defaults. The team provides a guide for migration; many adjustments can be automated according to their own statements.

All information about the new Rsbuild version can be found in the release notes on the GitHub project page and in the developers' announcement.

(fo)

Don't miss any news – follow us on Facebook, LinkedIn or Mastodon.

This article was originally published in German. It was translated with technical assistance and editorially reviewed before publication.