The content of this section is derived from the content of the following links and is subject to the CC BY 4.0 license.
The following contents can be assumed to be the result of modifications and deletions based on the original contents if not specifically stated.
Used to configure the behavior of @rspack/dev-server
.
Object
If the current application does not depend on @rspack/dev-server
, then the devServer config will have no effect.
For example, Rspack CLI depends on @rspack/dev-server
by default, so the devServer config can be used in Rspack CLI projects. Rsbuild has implemented its own dev server and provides a separate "server" config, so the devServer config cannot be used in Rsbuild projects.
string | string[] | 'all' | 'auto'
'auto'
Allow access to devServer's whitelist.
Object
'log' | 'info' | 'warn' | 'error' | 'none' | 'verbose'
'info'
The client's log level.
boolean | Object
true
Whether to report errors on the client's screen when a compilation error occurs.
boolean
true
Whether or not to show the progress of compilation on the client.
boolean | number
true
The number of times the development server will reconnect to the client. true
means unlimited number of times.
'ws' | 'sockjs'
ws
The transfer method between the client and the development server.
string | object
{}
URL of the ws server.
boolean
true
Whether to enable gzip compression.
object
{}
Control the behavior of the rspack-dev-middleware.
array | function | object
undefined
Add response headers.
boolean | object
false
Underhanded logic when a 404 page is requested.
'local-ip' | 'local-ipv4' | 'local-ipv6' | string
'local-ip'
The address of the development server.
boolean
true
Whether to enable hot updates.
boolean
true
Whether or not to reload the page. This configuration item is turned off when hot is turned on.
boolean
true
Whether the path corresponds to the product one by one.
function
Callback when devServer establishes a connection to the port.
boolean | string | object | [string, object]
true
Whether to open the browser when devServer starts.
'auto' | string | number
[]
Used to configure the port number.
object | [object, function]
Configure proxy, can be used to solve cross-domain issues, etc.
'http' | 'https' | 'spdy' | string | object
'http'
Configuration items for the server.
function (middlewares, devServer)
Custom middleware.
boolean | string | object | [string, object]
Used to configure whether to enable static servers from some directories (default is 'public').
string | object | [string, object]
Listens for changes to a series of files.
false | 'sockjs' | 'ws'
Used to configure the type of web socket server.