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.

HMR warnings after upgrading to Webpack 5.10.0

See original GitHub issue

Bug 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:

  1. Upgrade Webpack to 5.10.0
  2. Use next to run a Next.js app in dev mode.
  3. Make changes to a SSR page that is currently open in a browser so that HMR can kick in and auto-reload the page.
  4. 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

8reactions
subwaymatchcommented, Mar 31, 2021

My workaround is to add .[runtime] in the config.output.hotUpdateMainFilename option.

Below is my next.config.js file:

module.exports = {
  future: {
    webpack5: true,
  },
  webpack: (config, { isServer, dev, webpack }) => {
    console.log(`Webpack version: ${webpack.version}`);

    config.output.hotUpdateMainFilename =
      "static/webpack/[fullhash].[runtime].hot-update.json";

    if (!isServer) {
      config.resolve.fallback.fs = false;
    }

    return config;
  },
};

This is based on Nextjs’ default config:

https://github.com/vercel/next.js/blob/cd9bb986eba25006d4872e30eedf24ef5680bc6b/packages/next/build/webpack-config.ts#L898-L900

0reactions
balazsorban44commented, Jan 28, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

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