docs(hmr): document hmr.protocol setting (#16056)

This commit is contained in:
Stan Hu 2024-03-01 04:12:07 -08:00 committed by GitHub
parent aac2ef7752
commit ee562070f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -152,6 +152,8 @@ Disable or configure HMR connection (in cases where the HMR websocket must use a
Set `server.hmr.overlay` to `false` to disable the server error overlay. Set `server.hmr.overlay` to `false` to disable the server error overlay.
`protocol` sets the WebSocket protocol used for the HMR connection: `ws` (WebSocket) or `wss` (WebSocket Secure).
`clientPort` is an advanced option that overrides the port only on the client side, allowing you to serve the websocket on a different port than the client code looks for it on. `clientPort` is an advanced option that overrides the port only on the client side, allowing you to serve the websocket on a different port than the client code looks for it on.
When `server.hmr.server` is defined, Vite will process the HMR connection requests through the provided server. If not in middleware mode, Vite will attempt to process HMR connection requests through the existing server. This can be helpful when using self-signed certificates or when you want to expose Vite over a network on a single port. When `server.hmr.server` is defined, Vite will process the HMR connection requests through the provided server. If not in middleware mode, Vite will attempt to process HMR connection requests through the existing server. This can be helpful when using self-signed certificates or when you want to expose Vite over a network on a single port.