HMR warnings after upgrading to Webpack 5.10.0
See original GitHub issueBug report
After upgrading to Webpack 5.10.0, I see this warning a lot on the console —
warn - HotModuleReplacementPlugin
The configured output.hotUpdateMainFilename doesn't lead to unique filenames per runtime and HMR update differs between runtimes.
This might lead to incorrect runtime behavior of the applied update.
To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename option, or use the default config.
Everything seems to work fine, though.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Upgrade Webpack to 5.10.0
- Use
next
to run a Next.js app in dev mode. - Make changes to a SSR page that is currently open in a browser so that HMR can kick in and auto-reload the page.
- See warning on console —
warn - HotModuleReplacementPlugin The configured output.hotUpdateMainFilename doesn't lead to unique filenames per runtime and HMR update differs between runtimes. This might lead to incorrect runtime behavior of the applied update. To fix this, make sure to include [runtime] in the output.hotUpdateMainFilename option, or use the default config.
Expected behavior
No warnings.
Screenshots
N/A
System information
- OS: macOS
- Browser (if applies): Microsoft Edge
- Version of Next.js: 10.0.3
- Version of Node.js: v15.3.0
- Deployment:
next
(Dev mode)
Additional context
N/A
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:12 (7 by maintainers)
Top Results From Across the Web
node.js - Webpack issue when update 4.x to 5.x - Stack Overflow
Show activity on this post. I have a problem when i updated in my project the webpack package to V5. x. Here is...
Read more >Hot Module Replacement - webpack
warning. HMR is not intended for use in production, meaning it should only be used in development. See the building for production guide...
Read more >Webpack 5 release (2020-10-10)
JSON modules now align with the proposal and emit a warning when a non-default export is used. JSON modules no longer have named...
Read more >To v5 from v4 - webpack
Upgrade webpack 4 and its plugins/loaders · Make sure your build has no errors or warnings · Make sure to use mode ·...
Read more >Hot Module Replacement - webpack
Hot Module Replacement (HMR) exchanges, adds, or removes modules while an ... Instantly update the browser when modifications are made to CSS/JS in...
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 Free
Top 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
My workaround is to add
.[runtime]
in theconfig.output.hotUpdateMainFilename
option.Below is my
next.config.js
file:This is based on Nextjs’ default config:
https://github.com/vercel/next.js/blob/cd9bb986eba25006d4872e30eedf24ef5680bc6b/packages/next/build/webpack-config.ts#L898-L900
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.