webpack: HMR not working on webpack 5.66.0
Bug report
What is the current behavior? Hot module reloading is not working after updating webpack to v5.66.0.
If the current behavior is a bug, please provide the steps to reproduce.
- Clone https://github.com/saltire/react-node-boilerplate.
- Run
npm i webpack@latest
to update to 5.66.0. - Run
npm run watch
. - Modify
src/App.jsx
. The browser console reportsbundle rebuilding
twice, the request tomain.xxxxx.hot-update.json
fails with status 404, and the app does not update.
Notice the issue does not occur if webpack 5.65.0 is installed.
What is the expected behavior? When making a change to a jsx file, the app should reload automatically.
Other relevant information: webpack version: 5.66.0 Node.js version: 16 Operating System: MacOS Additional tools
This repo uses webpack-dev-middleware
, webpack-hot-middleware
, react-refresh
, and @pmmmwh/react-refresh-webpack-plugin
, among other packages. The issue may stem from a conflict with one of these, but I don’t have enough internal knowledge of webpack or these packages to say which. It could also be a misconfiguration on my part. I’m filing the issue with webpack
because I was able to isolate the problem to an update of this package.
Let me know if you need any more info!
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 11
- Comments: 39 (19 by maintainers)
@alexander-akait yeah, that’s what I think as well, we’ve been seeing double bundling on our side - though often times, the hash doesn’t change, but the files are deleted from the output directory. I’m trying to bisect when this started happening, I’ll post my results here shortly
Update: it’s starting from
5.66.0
- any prior version I tried (5.65.0
,5.64.4
,5.62.0
,5.64.0
,5.62.0
) works as expected.no work in v 5.72.1
try set webpack.config.js
I confirm the same issue. I have upgraded to Webpack 5.66, and my perfectly working configuration on Webpack 5.55, now triggers a full page reload on every change, even of simple CSS files.
webpack: 5.66.0 Node.js: 17 MacOS: 12.1
main.*.hot-update.json
fails with status 404, and the page does a full reload.We are seeing the same issue, a single change triggers a double compilation, and that causes the first compilation assets to be deleted (including the
*.hot-update.js(on)
files) - increasing theaggregateTimeout
appears to help a little, but it’s still a bit flaky.I’ll try to reduce to a minimal config - though may take me a few days to get to it.
node: v16.13.0 webpack: 5.66.0 macos: 11.6.2
Macbook Pro M1 chip experience an infinite loop of reload. Webpack: 5.83.1 Node: 16.15.1 React: 16.13.1
Console consist:
webpack.config.js:
This seem to be related to
output.clean: true
which removes the HMR update file on the second compilation. Maybe we should keep HMR files around for a while before removing them?The second cause of the problem seem to be the double compilation, which could have various reasons…
It can be memory problem, ideally we should find a way to prevent double compilation