-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
hmr might fail if there are new initial chunks #18548
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
Comments
Feel free to send a PR |
This issue had no activity for at least three months. It's subject to automatic issue closing if there is no activity in the next 15 days. |
bump |
Issue was closed because of inactivity. If you think this is still a valid issue, please file a new issue with additional information. |
Could we reopen this ? I forgot to commit a bump comment |
You can add a patch to handle this specific case: Inside hmrpack.js module.hot.check = function patchedHotCheck(applyOnUpdate) { The issue occurs because webpack's HMR system doesn't properly handle the transition of chunks from non-initial to initial during hot updates. You can Use webpack configuration or Use the runtime patch to address this issue. |
Bug report
What is the current behavior?
HMR might fail if one initial chunk occur at second compilation.
The reason:
If one chunk is not initial chunk in the first compilation, but is initial chunk in the second compilation, when apply hot updates, there will be some imports to the initial chunk, but at this moment, the initial chunks are not loaded, so webpack will go fetching that chunk, and treats it as async chunk, so if async chunk path is different from initial chunk path, it cannot find that chunk
If the current behavior is a bug, please provide the steps to reproduce.
repro repo:
https://github.com/JSerFeng/webpack-lazy-compilation-issue/tree/hmr
run
open the browser
modify
src/initial.js
What is the expected behavior?
Other relevant information:
webpack version: 5.92.1
The text was updated successfully, but these errors were encountered: