dev.server
- Type:
Object - Default:
{}
The config of DevServer can be modified through dev.server.
compress
- Type:
boolean - Default:
true
Whether to enable gzip compression for served static assets.
If you want to disable the gzip compression, you can set compress to false:
For more details, please refer to the Rsbuild - server.compress documentation.
headers
- Type:
Record<string, string> - Default:
undefined
Adds headers to all responses.
For more details, please refer to the Rsbuild - server.headers documentation.
historyApiFallback
- Type:
boolean | ConnectHistoryApiFallbackOptions - Default:
false
The index.html page will likely have to be served in place of any 404 responses. Enable dev.server.historyApiFallback by setting it to true:
For more configuration options, please refer to the Rsbuild - server.historyApiFallback documentation.
watch
- Type:
boolean - Default:
true
Whether to watch files change in directories such as mock/, server/, api/.
For more details, please refer to the Rsbuild - dev.watchFiles documentation.
cors
- Type:
boolean | import('cors').CorsOptions
Configure CORS (Cross-Origin Resource Sharing) for the development server.
The default configuration for cors in Modern.js follows Rsbuild's defaults:
For more configuration options and detailed usage, please refer to the Rsbuild - server.cors documentation.
proxy
- Type:
ProxyOptions[] | Record<string, string | ProxyOptions> - Default:
undefined
Configure proxy rules for the dev server, and forward requests to the specified service.
This option is the same as Rsbuild's server.proxy option, see Rsbuild - server.proxy for detailed usage.