webpack cache does not update when node_modules change, even after server restart #34380
gaurav5430
started this conversation in
Ideas
Replies: 1 comment 16 replies
-
Hi, Webpack 5 introduced caching for faster builds, which Webpack 4 lacked.
A possible solution could be that you use This will add HMR to your packages as well, improving the feedback loop during development. |
Beta Was this translation helpful? Give feedback.
16 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Run
next info
(available from version 12.0.8 and up)NA
What version of Next.js are you using?
11.1.3
What version of Node.js are you using?
v12.22.8
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
own setup with AWS
Describe the Bug
During development, we symlink to some local dependencies and install them in our nextjs project. These show up in node modules. When any file in these dependencies change, we expect that next js would hot reload the changes, instead what we have observed is that the webpack build runs again, but the changes are not reflected on the UI.
On debugging more, we could figure out that although the files in node_modules have changed, the files loaded by webpack on the browser are the same and not the new changed ones. We tried restarting the server to see if it fixes this, that does not seem to work. Since node modules is a special folder, we figured that it is possible that there are some specific rules for node modules due to which the changes are not being watched or something, so we also tried making some other changes in the app code so that hot reload happens and it can maybe pickup the changes in node modules as well. This also does not work.
On further understanding, it seems like the filesystem cache created by nextjs webpack config, is not updating even though the symlinked dependency has updated in node modules. If we delete the cache and run the server again, it works alright.
This was working fine before nextjs 11, and webpack 5
Expected Behavior
We would expect the changes in node modules to be hot reloaded and included in the build
To Reproduce
Beta Was this translation helpful? Give feedback.
All reactions