Skip to content
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

HMR warnings after upgrading to Webpack 5.10.0 #19865

Closed
paambaati opened this issue Dec 5, 2020 · 12 comments · Fixed by #26256
Closed

HMR warnings after upgrading to Webpack 5.10.0 #19865

paambaati opened this issue Dec 5, 2020 · 12 comments · Fixed by #26256
Labels
bug Issue was opened via the bug report template.

Comments

@paambaati
Copy link
Contributor

paambaati commented Dec 5, 2020

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

@paambaati paambaati added the bug Issue was opened via the bug report template. label Dec 5, 2020
@awareness481
Copy link
Contributor

Likely related to #18678

@Timer
Copy link
Member

Timer commented Dec 8, 2020

Duplicate of #18678

@Timer Timer marked this as a duplicate of #18678 Dec 8, 2020
@Timer Timer closed this as completed Dec 8, 2020
@timneutkens
Copy link
Member

I can't reproduce this warning with the latest version of webpack 5 and next@canary 🤔

@paambaati
Copy link
Contributor Author

@timneutkens I just checked out canary and I'm still seeing these warnings in 10.0.4-canary.3 and 5.10.0. Is there additional information I could provide to narrow this down?

@paambaati
Copy link
Contributor Author

@ivan-aksamentov
Copy link

ivan-aksamentov commented Feb 18, 2021

I was able to workaround this by prepending [runtime]- to the webpackConfig.output.hotUpdateChunkFilename and webpackConfig.output.hotUpdateMainFilename. Looks like this is the "new" Webpack 5 way. Probably should not be used with Webpack 4. Not sure about Webpack 5 versions before this change.

Taken from shellscape/webpack-plugin-serve:

Discussion:
shellscape/webpack-plugin-serve#206 (review)

Codez:
Evalon/webpack-plugin-serve@1dd1f37#diff-cf84b31417a308f8c05eaf8c08b5caf04ad3fbd8c83f41e3f7546c1955c18f3f

Update: Turns out this workaround also breaks the hot reloading. Code changes trigger full page reloads. :(

@subwaymatch
Copy link

subwaymatch commented 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:

hotUpdateMainFilename: isWebpack5
? 'static/webpack/[fullhash].hot-update.json'
: 'static/webpack/[hash].hot-update.json',

@paescuj
Copy link

paescuj commented Jun 16, 2021

Can we please reopen this? Still seeing those warnings in Next.js 11.

@timneutkens
Copy link
Member

Can we please reopen this? Still seeing those warnings in Next.js 11.

Please open a new issue with a full reproduction.

@paescuj
Copy link

paescuj commented Jun 16, 2021

Can we please reopen this? Still seeing those warnings in Next.js 11.

Please open a new issue with a full reproduction.

Will do, thanks!

@paescuj
Copy link

paescuj commented Jun 16, 2021

Sorry, I'm not able to provide a full reproduction since I don't know what's causing it. I'll open a new issues when having more information and using workaround from #19865 (comment) in the meantime.

kodiakhq bot pushed a commit that referenced this issue Jun 18, 2021
Updates the hotUpdateChunk to include `[runtime]` for web workers support.

Fixes #26152
Fixes #19865
Fixes #26144

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
flybayer pushed a commit to blitz-js/next.js that referenced this issue Jun 24, 2021
Updates the hotUpdateChunk to include `[runtime]` for web workers support.

Fixes vercel#26152
Fixes vercel#19865
Fixes vercel#26144

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
@balazsorban44
Copy link
Member

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.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants