Dev server
The rspack dev and rspack serve commands run a local development server through @rspack/dev-server. It provides hot module replacement (HMR), static file serving, proxying, and related development features.
Install dev server
@rspack/dev-server is an optional peer dependency of @rspack/cli.
Install it before using rspack dev, rspack serve, or rspack preview:
HMR
By default, Rspack enables HMR in dev mode. You can disable HMR by configuring the devServer.hot option in Rspack configuration.
Do not include [hash] or [contenthash] in output.cssFilename, otherwise CSS HMR may not work.
Proxy
The dev server includes proxy support. Configure the devServer.proxy option to proxy matching requests. This feature is powered by http-proxy-middleware. For example, you can proxy /api to http://localhost:3000 as follows:
For more devServer configuration options, please refer to devServer.

