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

vite-node server HMR is broken #14469

Closed
pi0 opened this issue Jul 29, 2022 · 7 comments · Fixed by nuxt/framework#6343
Closed

vite-node server HMR is broken #14469

pi0 opened this issue Jul 29, 2022 · 7 comments · Fixed by nuxt/framework#6343

Comments

@pi0
Copy link
Member

pi0 commented Jul 29, 2022

Environment

  • Operating System: Linux
  • Node Version: v16.15.0
  • Nuxt Version: 3.0.0-rc.6-27651720.5dc864d
  • Package Manager: yarn@1.22.19
  • Builder: vite
  • User Config: experimental
  • Runtime Modules: -
  • Build Modules: -

Reproduction

(on Windows, Linux, Docker (Linux) or WSL2 environment)

  • Create new project with npx nuxi init (swit
  • Enable vite-node with `experimental
  • Run dev server with npm run dev
  • Write simple app.vue such as <template><div>Hello world!</div></template>
  • Open http://localhost:3000
  • Edit app.vue
  • Reload

Describe the bug

Client is updated with HMR and subsequent reloads but server is not. Causing hydration error.

It might be related to the issue #12822 since now client HMR on Linux works and Server not (in current nuxt, it is otherwise). But also trying CHOKIDAR_USEPOLLING=1 I still have same issues.

image

Additional context

No response

Logs

No response

@pi0
Copy link
Member Author

pi0 commented Aug 2, 2022

I can also reproduce it on MacOS (testing on 13.1). Client HMR stops working when viteNode flag is set resulting in hydration mismatch:

image

@pi0 pi0 changed the title vite-node server HMR is broken on Linux and Windows vite-node server HMR is broken Aug 3, 2022
@pi0
Copy link
Member Author

pi0 commented Aug 3, 2022

@antfu Can you please check this? I can confirm on multiple mac versions it is also broken...

Do we have a watcher still with vite-node?

@antfu antfu self-assigned this Aug 4, 2022
@antfu
Copy link
Member

antfu commented Aug 4, 2022

Yes, we have Vite's watcher to invalidate the modules. I will investigate

@antfu
Copy link
Member

antfu commented Aug 4, 2022

I can confirm this bug in the edge build, but not in our development playground.

@antfu
Copy link
Member

antfu commented Aug 5, 2022

Is it still not working on Linux/Windows?

@pi0
Copy link
Member Author

pi0 commented Aug 5, 2022

@antfu Yes i could constantly reproduce on Windows (Windows 11 on PC + Parallers on M2 arm64) and Randomly on Linux (WSL). Will share a screen cast of issue. It is not directly fault of vite-node BTW but when we enable vite-node, since server watcher happens first, client watcher gets broken eventually.

@pi0
Copy link
Member Author

pi0 commented Aug 12, 2022

I can no longer reproduce it on rc.8. Seems an underlying library fixed the root cause!

@pi0 pi0 closed this as completed Aug 12, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
@danielroe danielroe transferred this issue from nuxt/framework Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants