-
-
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
feat: Allow hotUpdateGlobal to be a function #18672
base: main
Are you sure you want to change the base?
Conversation
For maintainers only:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add your case in test/hotCases
, we need at least one integration test
thanks, that's what I was missing, adding it! |
Hey @alexander-akait, I've been trying to add an integration test case, but I can't seem to make multiple entries work. I've been checking other tests to try and understand a bit more how everything works on these test cases, but I couldn't make it work. Maybe you can point me to some documentation or give me a little bit of guidance? Pretty much the idea would be to have 2 entries, and somehow "load" them in the same place and try applying some updates to both of them. (That's at least what I've tried in the I added some comments here https://github.com/webpack/webpack/pull/18672/files#diff-85de71d3c7829fd59bca8bb510eee5872830638ed236bb35fbc3151e1b95374aR6 Any help would be appreciated, thanks a lot! |
Never mind, finally figured it out 😄 |
hey @alexander-akait anything else I should do so this can be reviewed? thank you! |
50733bb
to
5f19810
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do small improve
Changes ready, let me know if I understood you properly and you were referring to those changes, thanks! |
please run |
Hey @alexander-akait , already did, It doesn't produce any changes |
2c929d8
to
b2e5dd6
Compare
hey @alexander-akait it should be ready now 😄 |
test: Add multiple-runtime case chore: fix test
b2e5dd6
to
80c9012
Compare
hey @alexander-akait could I get a review? thank you! |
What kind of change does this PR introduce?
As discussed in this issue this PR allows passing a function to
hotUpdateGlobal
with the following shapehotUpdateGlobal: (chunk: String) => string
, so if for any reason there needs to be multiple runtimes in the same page, and thesingle
runtime is not an option, thehotUpdateGlobal
function can be defined by chunk and multiple chunks can have HMR.Did you add tests for your changes?
I added a test that checks the defaults and integration tests in the hotCases
Does this PR introduce a breaking change?
What needs to be documented once your changes are merged?
Once this is merged and released, this https://webpack.js.org/configuration/output/#outputhotupdateglobal should be updated to show that it can also accept a function, and the shape of it.
I'd be happy to also update the documentation