Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to load hmr end-point address from vite.config #676

Closed
sionzee opened this issue Aug 4, 2020 · 1 comment · Fixed by #677
Closed

Ability to load hmr end-point address from vite.config #676

sionzee opened this issue Aug 4, 2020 · 1 comment · Fixed by #677

Comments

@sionzee
Copy link

sionzee commented Aug 4, 2020

Is your feature request related to a problem? Please describe.
The vite is using location.hostname to resolve location of the page:

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.

@sionzee
Copy link
Author

sionzee commented Aug 4, 2020

Looks like #674 issue is requesting the same feature. Feel free to close this one if you think it is duplication.

underfin added a commit to rolldown/vite that referenced this issue Aug 4, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant