@rspack/cli provides two common subcommands, serve and build, to simplify daily work. If you do not have @rspack/cli installed, please read the Quick Start section first.
@rspack/cli is not going to be compatible with webpack-cli, so there will be many differences between the two.
Run the rspack build
command, which will generate the output files for production.
$ rspack build # Read the rspack.config.js configuration file by default
$ rspack build -c ./your.config.js
Running the Rspack development server command will start a local development server that will listen for file changes and automatically refresh the browser.
$ rspack serve
$ rspack serve -c ./your.config.js
By default Rspack provides some common command line arguments, you can see all of them with --help.
Flags | |
---|---|
-c, --config [value] | Specify the path to the configuration file |
-m, --mode [value] | Specify the build mode |
--devtool [value] | Controls whether sourcemap is generated |
--analyze | Enables or disables build analysis |
-w, --json [filename] | Output the stats as a JSON file |
-w, --watch | Listen for file changes |
-h, --help | Show help information |
-v, --version | Show version number |