-
Notifications
You must be signed in to change notification settings - Fork 296
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
webpack-hot-middleware/client?reload=true
is no longer working with webpack 5.
#390
Comments
Very same problem. I use express + webpack-dev-middleware + webpack-hot-middleware for live reloading on save.
Did anyone find a way to get rid of this bug? |
The same problem. I need help |
+1 |
I've hacked with a |
Is this going to be addressed :)? |
There's been a few reports of webpack 5 issues, but I haven't had time to look into them. None of my active projects currently use hot-middleware, so this isn't a high prioritiy for me to investigate. If someone is able to produce a minimal reproducing case and then offer a PR which resolves it, I'd make time to review and merge it. |
who can solve it? it is so bad |
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
|
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 |
Any ETA on this one ?:) |
It seems to be working if (module['hot']) {
module['hot'].accept();
} |
I got the same problem and your solution can fix this issue , thank u . I hope this project's maintainer can fix it as soon as possible |
I was running into this issue and calling if (module['hot']) {
module['hot'].accept();
} |
It was already necessary with webpack 4... |
If you guys need a workaround, you can add
You also need to change
|
The same issue with Webpack 5, switch to this fork fix for now. |
Fork fix works, I guess we just have to wait for the fork to get merged into the main repository 😕 |
Hi @glenjamin, any ETA on this fix? Thanks in advance. |
+1 for this. any news? |
The latest state of webpack 5 support is that no-one has yet taken the time to understand what has actually changed and why that has caused a problem. Once that research has been done and a fix incorporated into #397 then it can be merged and released properly. This comment suggests the path forwards for anyone who is sufficiently motivated and has the time: #397 (comment) |
@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 webpack/webpack#12408 |
This solution worked for me by adding it to the main webpack entry point. |
@lukeapage So to fix this issue (#390), webpack/webpack#12408 must be addressed first right? |
@athrunsun yes either webpack needs a fix or this repo needs to work around it. |
i meet that problem in vue tsx file hmr, is it fixed now ? i use |
Found the same problem, forked the repo and did this change, worked for me |
Hi @lukeapage Today, when i have tried your fix, this error is showing :
To resolve this error i have modified this line in
to :
Is it a good solution ? |
hi
Hi @lukeapage This work for me. Thanks |
I believe this was fixed in Webpack webpack/webpack#12408 |
my situation createRoot(document.getElementById("app-root")).render(<Root />);
if (module.hot) {
module.hot.accept();
} 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
let container = null;
document.addEventListener("DOMContentLoaded", function (event) {
if (!container) {
container = document.getElementById("app-root");
const root = createRoot(container);
root.render(<Root />);
}
});
if (module.hot) {
module.hot.accept();
} the hot does not work any more, so i rolled it back .😥😥😥 |
+1. I'm having the same issue as you (with the exact same setup/workarounds applied) and I'm not seeing why it's not working. |
Somebody can create reproducible test repo? |
I can confirm with
|
Somebody can create reproducible test repo? I will fix |
@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
|
pmmmwh/react-refresh-webpack-plugin#784 i resloved this issue by remove |
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
// 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.
The text was updated successfully, but these errors were encountered: