Rsbuild comes with a lightweight CLI that includes commands such as dev
and build
.
The rsbuild dev
command is used to start a local development server and compile the source code in the development environment.
The rsbuild build
command will build the outputs for production in the dist/
directory by default.
The rsbuild preview
command is used to preview the production build outputs locally. Note that you need to execute the rsbuild build
command beforehand to generate the corresponding outputs.
The rsbuild inspect
command is used to view the Rsbuild config and Rspack config of the project.
When you run the command npx rsbuild inspect
in the project root directory, the following files will be generated in the dist
directory of the project:
rsbuild.config.js
: Represents the Rsbuild configuration used during the build.rspack.config.web.js
: Represents the Rspack configuration used during the build.By default, the inspect command outputs the configuration for the development environment. You can add the --env production
option to output the configuration for the production environment:
By default, the inspect command omits the content of functions in the configuration object. You can add the --verbose
option to output the complete content of functions:
If the current project has multiple build targets, such as building browser artifact and Node.js artifact simultaneously, multiple Rspack configuration files will be generated in the dist
directory.