CLI
Rsbuild includes a lightweight CLI with commands like rsbuild dev and rsbuild build.
All commands
To view all available CLI commands, run this command in your project directory:
The output is shown below:
Common flags
The Rsbuild CLI includes several common flags that work with all commands:
rsbuild dev
The rsbuild dev command starts a local dev server and compiles source code for development.
Start the dev server by running rsbuild directly (equivalent to rsbuild dev):
Opening page
The --open option automatically opens a page when starting the dev server (equivalent to setting server.open to true).
The --open option also accepts a specific URL to open. For example:
The --open option can also be abbreviated to -o:
When using both server.open and --open, the --open option takes precedence.
rsbuild build
The rsbuild build command builds production outputs in the dist/ directory by default.
rsbuild preview
The rsbuild preview command previews production build outputs locally. You must run rsbuild build first to generate the outputs.
The preview command is only used for local preview. Do not use it for production servers, as it is not designed for that.
rsbuild inspect
The rsbuild inspect command displays the project's Rsbuild and Rspack configurations.
Running npx rsbuild inspect in the project root generates the following files in the dist/.rsbuild directory:
rsbuild.config.mjs: Represents the Rsbuild configuration used during the build.rspack.config.web.mjs: Represents the Rspack configuration used during the build.
Setting mode
By default, the inspect command outputs configuration for development mode. To output production mode configuration, add the --mode production option:
Verbose content
By default, the inspect command omits function content in the configuration object. To output complete function content, add the --verbose option:
Multiple targets
If the current project has multiple build targets (such as building both browser and Node.js bundles), multiple Rspack configuration files will be generated in the dist/.rsbuild directory.

