Skip to content

The Nx Plugin for Rsbuild contains executors and generators that support building applications using Rsbuild. In an Rsbuild monorepo, it wires each project into Nx so you can build, serve, and cache them from a single workspace.

The @nx/rsbuild plugin supports the following package versions.

PackageSupported VersionsDefault Installed
@rsbuild/core^1.0.0 || ^2.0.02.0.6

Nx generators install the latest supported version automatically when scaffolding new projects. When @rsbuild/core is already installed in your workspace, generators detect the installed version and keep it in place rather than overwriting it.

In any Nx workspace, you can install @nx/rsbuild by running the following command:

Terminal window
nx add @nx/rsbuild

This will install the correct version of @nx/rsbuild.

The @nx/rsbuild plugin looks for these configuration files in directories that also contain a package.json or project.json:

  • rsbuild.config.js
  • rsbuild.config.ts
  • rsbuild.config.mjs
  • rsbuild.config.mts
  • rsbuild.config.cjs
  • rsbuild.config.cts

Nx creates a cached build task using the output directory from the Rsbuild configuration, continuous dev and preview tasks, and an inspect task. It also creates a cached typecheck task when the project has a tsconfig*.json file.

Configure the plugin in nx.json:

nx.json
{
"plugins": [
{
"plugin": "@nx/rsbuild",
"options": {
"buildTargetName": "build",
"devTargetName": "dev",
"previewTargetName": "preview",
"inspectTargetName": "inspect",
"typecheckTargetName": "typecheck",
"buildDepsTargetName": "build-deps",
"watchDepsTargetName": "watch-deps"
}
}
]
}
OptionTypeDefaultDescription
buildTargetNamestringbuildName of the cached production build task.
devTargetNamestringdevName of the continuous development server task.
previewTargetNamestringpreviewName of the continuous production preview task.
inspectTargetNamestringinspectName of the Rsbuild configuration inspection task.
typecheckTargetNamestringtypecheckName of the cached TypeScript typecheck task.
buildDepsTargetNamestringnoneName of an optional dependency build task.
watchDepsTargetNamestringnoneName of an optional dependency watch task.

Use include and exclude glob patterns on the plugin entry to scope inference. A target defaults plugin filter must use the exact identifier @nx/rsbuild.

You can generate a new application that uses Rsbuild with the following command:

Terminal window
nx g @nx/react:app myapp --bundler=rsbuild

This will create a new application configured to use Rsbuild for building.

In CI, Nx runs nx affected to rebuild and retest only the projects a change touches, and caches results to skip repeated work.

For a complete pipeline, see Set up CI.