webpack-hot-middleware: `webpack-hot-middleware/client?reload=true` is no longer working with webpack 5.
- Operating System: Mac
- Node Version: v14.14.0
- NPM Version: 6.14.8
- webpack Version: 5.1.3
- ${package} Version: 2.25.0
Expected Behavior
Expect circumstances that caused reload in webpack 4 would continue doing so in 5
Actual Behavior
Upgrading to webpack 5 causes reload to stop working, when it was with 4
Code
// webpack.config.js
// If your bitchin' code blocks are over 20 lines, please paste a link to a gist
// (https://gist.github.com).
// additional code, HEY YO remove this block if you don't need it
How Do We Reproduce?
Find code that reloads with webpack 4, and then upgrade to 5.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 23
- Comments: 36 (2 by maintainers)
Commits related to this issue
- fix(app): temporary webpack5 'hotfix' https://github.com/webpack-contrib/webpack-hot-middleware/issues/390 — committed to nuxt/framework by danielroe 3 years ago
- fix(app): temporary webpack5 'hotfix' (#290) https://github.com/webpack-contrib/webpack-hot-middleware/issues/390 — committed to nuxt/framework by danielroe 3 years ago
- Temporary fix https://github.com/webpack-contrib/webpack-hot-middleware/issues/390 — committed to hfsaito/webpack-hot-middleware by hfsaito 3 years ago
It seems to be working
Very same problem. I use express + webpack-dev-middleware + webpack-hot-middleware for live reloading on save. After update to webpack 5 I can’t longer use live reload with this console warning
Did anyone find a way to get rid of this bug?
I believe it may be a webpack 5 bug. I also created a PR that works around it, but I have no idea what I am doing or if the fix is hacky.
I combined the 2 PR’s that fix webpack 5 bugs on my forked master branch, feel free to use it in npm
e.g. for yarn
I was running into this issue and calling
module['hot'].accept()
in browser like @zhyafe mentioned fixes it for me 👍If you guys need a workaround, you can add
?reload=true
to your entrypoint in you webpack config:You also need to change
ignoreUnaccepted
tofalse
in process-update.js inside the webpack-hot-middleware moduleIt was already necessary with webpack 4…
This solution worked for me by adding it to the main webpack entry point.
@glenjamin i took the time way back when I made my work around or - and raised a bug with webpack - it’s a bit hidden so repeating it here https://github.com/webpack/webpack/issues/12408
Thanks for doing this!
I’m intending to get around to this soonish, but i’m not getting a lot of free time at the moment
who can solve it? it is so bad
@alexander-akait I was able to create a test repo. However, I figured out that reload and overlay are both working fine in the test repo.
Long story short, I found out there is an issue in our custom CLI when turning off
esModule
fromcss-loader
then the reload would not work.my situation for “react”: “^18.2.0” at the root like this:
it works, but this is a warning:
to fix this warning : https://stackoverflow.com/questions/71792005/react-18-you-are-calling-reactdomclient-createroot-on-a-container-that-has-a
the hot does not work any more, so i rolled it back .😥😥😥
I believe this was fixed in Webpack https://github.com/webpack/webpack/issues/12408
Found the same problem, forked the repo and did this change, worked for me
+1 for this. any news?
Any ETA on this one ?😃
Is this going to be addressed 😃?
+1