environments
Rsbuild supports building outputs for multiple environments. You can use environments to define different Rsbuild configurations for each environment.
Please refer to Multi-environment builds for more information.
- Type:
- Default:
undefined
Available options
EnvironmentConfig is a subset of the Rsbuild configuration, supporting most options.
The following options can only be configured globally, not inside environments:
rootmodelogLevelcustomLoggerenvironmentsserver.*(except server.publicDir and server.serveAssets)dev.watchFilesdev.cliShortcuts
Example
Configure Rsbuild configuration for web (client) and node (SSR) environments:
For the web environment, the merged Rsbuild configuration is:
For the node environment, the merged Rsbuild configuration is:
Environment name
Since environment names are used in directory names and object property names, we recommend using only letters, numbers, -, _, and $. When other characters are used, Rsbuild will show a warning.

