-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Description
Is your feature request related to a problem? Please describe.
The vite is using location.hostname to resolve location of the page:
Line 35 in a47429d
| const socketUrl = `${socketProtocol}://${location.hostname}:${__PORT__}` |
Which results in issue when people are using custom forwarding with specific port or doing other similar stuff.
We would like to have property at config where is "hmr" for client located.
eg.:
hmr: {
hostname: "localhost"
}In our case we are using vite as Library and vite should be restricted to localhost only. Where location.hostname is the forwarded url which has no the hmr port enabled.
Describe the solution you'd like
Vite should support custom url for hmr or be more connected to hostname property at ServerConfig.
Additional context
WSL have many issues around port-forwarding. So the root of the page is running on whatever:port and vite is located at localhost:port. When whatever:port is visited then vite's hmr is trying to open whatever:hmrport, even when vite-hmr + client-code are loaded from localhost:port.