The rsbuild dev command is used to start a local development server and compile the source code in the development environment.
Usage: rsbuild dev [options]Options:
--open open the page in browser on startup
--port <port> specify a port number for Rsbuild Server to listen
--host <host> specify the host that the Rsbuild Server listens to
-c --config <config> specify the configuration file, can be a relative or absolute path
-h, --help display helpforcommand
The rsbuild build command will build the outputs for production in the dist/ directory by default.
Usage: rsbuild build [options]Options:
-w --watch turn on watch mode, watchfor changes and rebuild
-c --config <config> specify the configuration file, can be a relative or absolute path
-h, --help display helpforcommand
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.
Do not use this as a production server as it's not designed for it.
Usage: rsbuild preview [options]Options:
--open open the page in browser on startup
--port <port> specify a port number for Rsbuild Server to listen
--host <host> specify the host that the Rsbuild Server listens to
-c --config <config> specify the configuration file, can be a relative or absolute path
-h, --help display helpforcommand
The rsbuild inspect command is used to view the Rsbuild config and Rspack config of the project.
Usage: rsbuild inspect [options]Options:
--env <env> view the configuration in the target environment (default: "development") --output <output> Specify the path to output in the dist (default: "/") --verbose Show the full functionin the result
-c --config <config> specify the configuration file, can be a relative or absolute path
-h, --help show commandhelp
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.
➜ npx rsbuild inspect
Inspect config succeed, open following files to view the content:
- Rsbuild Config: /project/dist/rsbuild.config.js
- Rspack Config (web): /project/dist/rspack.config.web.js
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.
➜ npx rsbuild inspect
Inspect config succeed, open following files to view the content:
- Rsbuild Config: /project/dist/rsbuild.config.js
- Rspack Config (web): /project/dist/rspack.config.web.js
- Rspack Config (node): /project/dist/rspack.config.node.js