-
Notifications
You must be signed in to change notification settings - Fork 110
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: ModuleFederation 2.0 support #674
Conversation
🦋 Changeset detectedLatest commit: f4e1cc8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
shared: { | ||
react: { | ||
singleton: true, | ||
eager: true, |
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.
Why do they have to be eager?
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.
react-native
and react
need to be present for initialisation of the environment done in react-native/Libraries/Core/InitializeCore.js
- Hermes engine doesn't have event loop on its own -> no microtasks -> no timers like setImmediate
or setTimeout
.
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.
they can most likely be made not eager but that would require rewriting the initialization part and maintaining it here. OOT platforms could also potentially customize it (im not sure this is the case now though)
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.
So I'm guessing there's no promise either? Like wouldn't it help if the entrypoint itself returned a promise so that entry setup itself is asynchronous? Like my hoisted runtime experiment does.
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.
I wonder if lynx supports event loops. 🤔
This is something I'll probably want to bake into our vm if possible
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.
So I'm guessing there's no promise either? Like wouldn't it help if the entrypoint itself returned a promise so that entry setup itself is asynchronous? Like my hoisted runtime experiment does.
yeah that would be ideal, but that would need more tinkering. I think I tried with hoisted runtime once but didn't pursue it much further. The biggest limiting factor is maintenance of custom initialisation logic.
On the other side, @robik once had an idea of creating an extra layer between RN Core and Hermes called RN Runtime which could be a place for stuff like this. Not sure whats the status of that, maybe he can share something here as well :)
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.
Yeah, I think this would solve this issue. The RFC is in pre-published state for now, should be up for discussions soon :)
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.
LGTM
Summary
Closes #518
ModuleFederationPlugin
toModuleFederationPluginV1
ModuleFederationPlugin
as wrapper for MF1 with wrapper to make this a non-breaking changeModuleFederationPluginV2
@deprecated
to all federated utilsTest plan