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

If HMR is disabled, I think it's not necessary to connect to websocket #6315

Closed
4 tasks done
hipi opened this issue Dec 30, 2021 · 4 comments
Closed
4 tasks done

If HMR is disabled, I think it's not necessary to connect to websocket #6315

hipi opened this issue Dec 30, 2021 · 4 comments

Comments

@hipi
Copy link

hipi commented Dec 30, 2021

Clear and concise description of the problem

when

server:{
  hmr:false,
}

packages/vite/src/client/client.ts should not connect to Websocket

Suggested solution

packages/vite/src/client/client.ts add configuration

Alternative

No response

Additional context

No response

Validations

@hipi hipi changed the title If HMR connection is disabled, I think it's not necessary to connect to websocket If HMR is disabled, I think it's not necessary to connect to websocket Dec 30, 2021
@bluwy bluwy added the feat: hmr label Apr 1, 2022
@clement4saunier
Copy link

This is so evident and takes so much time to be treated it's disappointing, I love vite but if my production site refreshes the page every minute because of a websocket it don't need, I can't disable it for some reasons and nothing gets done about it for months why bother.

@ctburenski
Copy link

This was unexpected behaviour for me - I had this occur when using codespaces, and the page continued to refresh when it was disabled.

I tried opening the port for HMR, but the port-forwarding on codespaces maps ports to subdomains, and I decided to develop locally instead of trying to find a way to tell Vite to use a completely different url or set up a reverse proxy just for HMR.

@bluwy
Copy link
Member

bluwy commented Jun 26, 2022

The websocket is used for more than just HMR, including showing error overlay from server and trigger full page reloads from plugins. Having server.hmr: false turn those off could be confusing (maybe not as destructive if we have docs). Otherwise perhaps #6090 might help here too.

@sapphi-red
Copy link
Member

This feature request seems to be requested to prevent the infinite reload problem.
I'm closing this issue because #9007 fixed that problem.
If there is other reasons, please create a new issue with the reason.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants