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

feat: allow disabling ws server completely if hmr: false #2474

Closed

Conversation

danielroe
Copy link
Contributor

@danielroe danielroe commented Mar 11, 2021

Vite exposes the option of disabling HMR completely. I'd welcome a contrary opinion, but there seems to be no reason to start a WS server in this case, and there are reasons why users might want to have it disabled.

In this instance we might also consider not attempting a connection in packages/vite/src/client/client.ts either, or disabling the client completely.

@thebrownfox
Copy link

@thebrownfox
Copy link

@danielroe happens 🙈 I was just curious and it struck me why would you want to do the opposite 😅

@thebrownfox
Copy link

@danielroe sorry to bother but this should solve the issue (nuxt/vite#70), right? When do you think it could be released? I'd love to use vite in this particular project.

thebrownfox
thebrownfox previously approved these changes Mar 11, 2021
@antfu antfu added the p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority) label Mar 15, 2021
Copy link
Member

@antfu antfu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in the comments. Marked as changed requested for tracking

@danielroe
Copy link
Contributor Author

Apologies for the delay. An initial mock implementation done. Very happy for changes to be made 👍

@antfu
Copy link
Member

antfu commented May 28, 2021

From our last meeting with Evan, our concern is that the Websocket Server is not only for HMR but also for page reloading or plugins. And it's not very clear why you want to disable this completely, can you provide more context? Thanks

@thebrownfox
Copy link

From our last meeting with Evan, our concern is that the Websocket Server is not only for HMR but also for page reloading or plugins. And it's not very clear why you want to disable this completely, can you provide more context? Thanks

In my case I need sometimes to see what's going on on dev/staging server, thus I need dev environment. It's possible to set it up in plain vue, but impossible in nuxt -> I need to startup dev server but without all of the HMR as nothing changes on file system. I tried to configure reverse proxy to work with the websocket, but without any success so far.

@patak-dev
Copy link
Member

@danielroe is this feat still needed? Maybe we should close this one if it isnt longer blocking you

@Enteleform
Copy link

@danielroe is this feat still needed? Maybe we should close this one if it isnt longer blocking you

I think there might be other issues that could be resolved by this?

Not 100% sure that they're related, but I found this PR referenced while investigating the CodeSandbox issue (which also happens with Vue, not just Nuxt).

@patak-dev
Copy link
Member

Closing this one, IIUC, this isn't an issue for Nuxt at this point. @danielroe would you open an issue to keep discussing the use cases for something like this if it is still required?

@patak-dev patak-dev closed this May 12, 2022
@danielroe danielroe deleted the allow-disabling-ws-completely branch May 12, 2022 22:30
@hxlniada
Copy link

why close this.

@Plasma
Copy link

Plasma commented Sep 8, 2022

I've encountered wanting to disable this during development because we don't use have a SPA app that we want reloading, instead we will just reload the page as needed. While hmr: false is set, we still receive a websocket error in console during development, would be great if this could be re-visited, thank you.

@bluwy
Copy link
Member

bluwy commented Sep 10, 2022

#6315 has more info on how the ws server is still needed.

@JadenH
Copy link

JadenH commented Sep 20, 2022

I've also run into the same use case where I can't have a websocket connection. Totally cool with a separate config as I can see how it's confusing to tie the websocket functionality to hmr when the websocket is used for other things.

I'd like to propose something like this:

...
server: {
  ws: false
}
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants