HMR does not pick up updates to data
See original GitHub issueEnvironment
Running on WSL but have had the same issue in a containerized application…
Tested in latest Firefox and Chrome with identical results.
Nuxt CLI v3.0.0-27288761.d3fb512
RootDir: …
Nuxt project info:
- Operating System:
Linux
- Node Version:
v16.13.0
- Nuxt Version:
3.0.0-27288761.d3fb512
- Package Manager:
yarn@1.22.17
- Bundler:
Vite
- User Config:
-
- Runtime Modules:
-
- Build Modules:
-
Reproduction
https://github.com/radusuciu/nuxt3-app
Describe the bug
Updated data is not picked up by HMR. Updating the template is. Data updates are reflected after a full refresh only.
Potentially related to #1036 but I don’t see any errors and it isn’t sporadic - it just doesn’t work even though Vite does seem to pick up the updates judging by the “Vite server built in XXms” logs messages and “[vite] hot updated: /app.vue” output in the console.
Additional context
I have no issues with HMR in nuxt2, nor if I use vite by itself.
Logs
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:21 (9 by maintainers)
Top Results From Across the Web
Webpack HMR never updates the page - Stack Overflow
The webpack/hot/only-dev-server runtime only updates modules that are hot-replaceable and doesn't do a full reload. If you don't care about full ...
Read more >HMR API - Vite
This is the client HMR API. For handling HMR update in plugins, see handleHotUpdate. The manual HMR API is primarily intended for framework...
Read more >A Deep Dive into Hot Module Replacement with Webpack ...
The goal of HMR is to avoid full page reloads. Currently, the application doesn't accept hot updates, because we haven't instructed it to...
Read more >Hot Module Replacement - webpack
Hot Module Replacement (HMR) exchanges, adds, or removes modules while an application is running ... If a module has no HMR handlers, the...
Read more >Webpack's Hot Module Replacement Feature Explained
The hot update will be sent to the HMR server, which will send the updates to HMR runtime. HMR runtime will unpack the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, @danielroe, your instinct was right after all:
I kept digging inside @vitejs/plugin-vue and found out that if I add a 100ms sleep inside
handleHotUpdate
function after file is read, the autoupdates start working. Then I’ve found this issue, and although it mentions Windows (this was also your instinct I guess, since you asked if I have Windows), the fix worked for me in Ubuntu:After I set
usePolling
totrue
, it started working as expected. Thank you for your help, I guess this can be closed after @radusuciu confirms.Thanks for sharing reproductions. I can confirm the same issue on WSL2 and also normal Linux servers and windows. HMR only works fine on a macOS laptop with fsevents.
An interesting finding is that native watcher, works but only for one instance. Disabling server [watcher] with
ssr: false
, client watcher and HMR start to work.