server.printUrls
- Type:
- Default:
true
Controls whether and how server URLs are printed when the server starts.
By default, when you start the dev server or preview server, Rsbuild will print the following logs:
Custom logging
server.printUrls can be set to a function, with parameters including port, protocol, urls and routes.
Modify URL
If the printUrls function returns a URLs array, Rsbuild prints these URLs to the terminal in the default format:
Output:
You may also return an array containing both strings and objects. Each object may include an optional label that overrides the default Local: or Network: label; if omitted, the default label is used:
Output:
Fully customizable
If the printUrls function does not return a value, Rsbuild will not print the server's URL addresses. You can customize the log content based on the parameters and output it to the terminal yourself.
MPA output
If the current project contains multiple pages, you can generate a separate URL for each page based on the routes parameter.
For example, when the project contains two pages, index and detail, the content of the routes would be:
Disable output
Setting server.printUrls to false will prevent Rsbuild from printing the server URLs.
HTML disabled
If tools.htmlPlugin is set to false, Rsbuild will not generate HTML files.
In this case, if there is at least one environment with output.target: 'web', Rsbuild will print the URL corresponding to server.base by default. Otherwise, Rsbuild will not print the server URLs.
You can still customize the printed URLs using the server.printUrls function, which has a higher priority.
Output:

