-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Hot module replacement (HMR) not working with serverMiddleware dependencies #8976
Comments
Thanks for reproduction @rchl. I think issue is that, for HMR detection we depend on require.cache to create dependency graph (https://github.com/nuxt/nuxt.js/blob/f08f4efcde7bc174fd9b68a2a5a785d504659391/packages/utils/src/cjs.js#L47). Using jiti, we sync with I will check to see if there is an easy fix. Otherwise we have to wait for nitro (or you can opt-in) since this method of HMR is unstable anyway... |
Fixed in jiti @ 1.6.4. You have to use |
Awesome. Thanks! |
I confirmed on NUXT@2.15.6, NOT working. I check the |
It might be a different case. The issue I've reported is fixed. Feel free to report a new issue with more details. (But I believe that CommonJS case still doesn't work. You have to use the ES Imports syntax for this to work.) |
Good, I got the point, thanks |
Hot module replacement doesn't trigger when editing a file that is imported from server middleware.
Changing the server middleware file itself does trigger HMR for it but still doesn't reload imported modules.
Versions
Reproduction
https://github.com/rchl/NuxtServerMiddlewareHMR
Steps to reproduce
yarn dev
test123
or12345
values inapi/server-middleware-util.js
What is Expected?
The updated values are reflected on the page
What is actually happening?
The page keeps showing values before the change.
The text was updated successfully, but these errors were encountered: