question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`vite-node` server HMR is broken

See original GitHub issue

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 https://github.com/nuxt/framework/issues/2047 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

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
pi0commented, Aug 12, 2022

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

0reactions
pi0commented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting - Vite
If you are running Vite with WSL2, Vite cannot watch file changes in some conditions. See server.watch option. A full reload happens instead...
Read more >
node.js - Vite Hot Reload not working instead its reloading ...
i just migrated my CRA to vite successfully using the link https://dev.to/nilanth/use-vite-for-react-apps-instead-of-cra-3pkg , but whenever ...
Read more >
Explore Hot Module Reloading integration of Vite with ...
HMR works as follows: A Node server serves the initial HTML page and initial versions of the JS/CSS/Vue files; The initial HTML page...
Read more >
Hot Module Replacement - webpack
All we need to do is update our webpack-dev-server configuration, and use webpack's built-in HMR plugin. We'll also remove the entry point for...
Read more >
Vite JS - Created to perform - collective:mind | DEV
It is packet with blazingly fast HMR and Rollup bundler for highly optimized static ... Vite's default types are for its Node.js API....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found