Configure the client code injected by Rsbuild during the development process. This can be used to set the WebSocket URL for HMR.
By default, when you start the dev server and visit the http://localhost:8080/
, a WebSocket request is made to ws://localhost:8080/rsbuild-hmr
, establishing a connection between the page and the dev server.
In some development scenarios, you may need to adjust the WebSocket URL to ensure that the WebSocket request can connect correctly.
For example, if you are developing using a proxy tool, you may actually be accessing an online domain. In this case, you can manually configure dev.client
to point the WebSocket URL to your local dev server. Below is an example where the WebSocket request URL is ws://127.0.0.1:8080/rsbuild-hmr
: