-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
Using multiple entry files does not work with HMR - hotUpdateGlobal #18668
Comments
Expected, you have multile runtimes on the same page, but the one HMR updating function, your patch doesn't fix the problem really, just workaround for your case (and will break HMR for another cases, when you split your chunks), please use Feel free to feedback |
Hey @alexander-akait , in our case the problem is that For normal cases it would simply work as it has been working. The patch of course is just a workaround to validate that was the problem, but the idea is being able to maybe provide that way of differentiating the runtimes (even if they are in the same page), that's why I was proposing the usage of Maybe it was wrong to open a bug because this might be more like asking for a feature instead? Let me know what you think, thanks! |
Using chunks ids is a bad idea and wrong here, not each chunk has runtime, technical we can allow to setup |
But there is a question about entries without runtime, which HMR functions they should be use... |
I see, what can be done to maybe elaborate this a bit more? I would be happy to contribute, I simply lack a lot of the context and cases that need to be covered since webpack is quite a complex tool and covers many cases, but with a bit of guidance/requirements I would be happy to put together a proposal/poc or whatever you think is best, if you think we can try and move this forward of course 😄 Thank you! |
I can accept a PR to allow to use |
ready #18672 |
Bug report
What is the current behavior?
When the config has multiple entries, and these entries are loaded in the same page, HMR doesn't work properly and it throws an error like this
The first file changed will actually work, but the rest of files won't work.
If the current behavior is a bug, please provide the steps to reproduce.
I created this repository so its easy to reproduce. Plus a small patch with some changes that fix the behavior.
Even though, not directly related, I think this would also fix this problem module-federation/module-federation-examples#358
Some extra information, the usage of
output.uniqueName
doesn't work for this use case, as the build is the same, and both entry points will end up with the same problemWhat is the expected behavior?
The expected behavior would be that if I have many entry points, and they are loaded in the same page, HMR should work for all of the files.
All of these said, as I also say in the README of the repository, I would like to open a PR to fix this problem, but I'm just asking for a little bit of guidance of how the modification to hotUpdateGlobal done in the patch could be done here instead. Maybe by using something like
[name]
or[id]
in the config?Thank you!
Other relevant information:
webpack version: 5.93.0
Node.js version: 20.5.1
Operating System: Mac OS
Additional tools: webpack hot middleware
The text was updated successfully, but these errors were encountered: