Skip to content
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

Merged
merged 110 commits into from
Oct 29, 2024
Merged

Conversation

jbroma
Copy link
Member

@jbroma jbroma commented Jul 26, 2024

Summary

Closes #518

  • - introduce separate tester for MF2
  • - rename ModuleFederationPlugin to ModuleFederationPluginV1
  • - keep ModuleFederationPlugin as wrapper for MF1 with wrapper to make this a non-breaking change
  • - add ModuleFederationPluginV2
  • - add @deprecated to all federated utils

Test plan

  • - unit tests for MF2 plugin
  • - tester federation V1 works
  • - tester federation V2 works

Copy link

changeset-bot bot commented Jul 26, 2024

🦋 Changeset detected

Latest commit: f4e1cc8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@callstack/repack Minor
@callstack/repack-dev-server Minor
@callstack/repack-init Minor

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

Copy link

vercel bot commented Jul 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
repack-website ⬜️ Ignored (Inspect) Visit Preview Oct 29, 2024 4:40pm

@jbroma jbroma changed the title [WIP] feat: ModuleFederation 2.0 support feat: ModuleFederation 2.0 support Oct 16, 2024
@jbroma jbroma marked this pull request as ready for review October 16, 2024 15:41
@jbroma jbroma changed the title feat: ModuleFederation 2.0 support [BREAKING] feat: ModuleFederation 2.0 support Oct 16, 2024
shared: {
react: {
singleton: true,
eager: true,
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Member Author

@jbroma jbroma Oct 16, 2024

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)

Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Member Author

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 :)

Copy link
Member

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 :)

@jbroma jbroma changed the title [BREAKING] feat: ModuleFederation 2.0 support feat: ModuleFederation 2.0 support Oct 29, 2024
Copy link
Member

@thymikee thymikee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :shipit:

@jbroma jbroma merged commit 9f4ad85 into main Oct 29, 2024
5 checks passed
@jbroma jbroma deleted the feat/module-federation-2-support branch October 29, 2024 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adopt the new federation runtime
4 participants