-
-
Notifications
You must be signed in to change notification settings - Fork 271
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
fix(bridge-react): prevent react-dom/client being bundled #3476
base: main
Are you sure you want to change the base?
fix(bridge-react): prevent react-dom/client being bundled #3476
Conversation
🦋 Changeset detectedLatest commit: f29b319 The changes in this PR will be included in the next version bump. This PR includes changesets to release 29 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
…ndex.*.js this otherwise causes the package to be incompatible with a react 19 BREAKING CHANGE: react-dom/client code will not be bundled into the bridge-react module anymore
313644e
to
f29b319
Compare
I skipped some of the steps like adding tests since that seems a bit much for this, but let me know if some extra work is needed from my side for this to be merged. |
@francisduvivier hello, thanks for your pr. And I have checked |
Hi @danpeen, that is a good question, I have tried my best to specify it in the reproduction part in the related issue:
|
Hi @francisduvivier, i got what you mean. Here is the thing:
and you can try even if we set the and if we truly bundled the react or react-dom into the final assets, i think you can find code like this |
This otherwise causes the package to be incompatible with a react 19
BREAKING CHANGE: react-dom/client code will not be bundled into the bridge-react module anymore
Description
This PR changes the vite rollup config for the bridge-react package in order not to bundle react-dom/client.
I assume that this inclusion into the bundle was accidental, since react-dom/client is part of react-dom which is a peer dependency, and peer dependencies are marked as external already in the rollup config.
The inclusion of this v18 react-dom/client module code also hinders compatibility with remote react v19 modules that want to use react bridge. So this PR fixes that part of imcompatibility with react v19, I don't know if there is other issues with react v19 though.
To see what I mean, you can look at the bridge-react/dist/index.es.js
Technically this fix can be breaking if someone somehow depends on the react-dom/client code being bundled into the @module-federation/bridge-react package.
Related Issue
#3477
Types of changes
Checklist