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(angular): add dynamic federation support to mfe generator #9551
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/nrwl/nx-dev/9ttFPzVhihDWFaSq4qxN6o37pChM |
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! 🎉
); | ||
|
||
if (!hostMfeConfigPath || !tree.exists(hostMfeConfigPath)) { | ||
throw new Error( |
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.
Maybe mention mfe.manfest.json
as well in case the user meant to use dynamic host -- maybe they renamed the file without realizing the problem.
Can we do some validation on mfe.config.js
to guard on this edge case? i.e. that the host should be using dynamic remotes, but the dynamic manifest isn't found.
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.
Looks good overall.
There is an edge case where the user may rename the config files (mfe.config.js
and mfe.manifest.json
), and it's not obvious that this will cause minor issues later when generating new remotes.
db07eaf
to
5c37b61
Compare
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Current Behavior
Our generators currently have no method of generating a Module Federation setup that uses Dynamic Federation.
Expected Behavior
Our
setup-mfe
generator should support creating a Dynamic Federation setup.Only
host
apps really need to understand the concept of Dynamic Federation as it is within the host app that the wiring of the remote apps takes place.We want to promote a Dynamic Federation pattern that consists of:
Record<string, string>
matching:remoteName: remoteUrl
Therefore we should aim to achieve 3 things:
setup-mfe
should be able to create a host app with a pattern for dynamic federationhost
generator should have a--dynamic
flag that will specify that the host should be created following the dynamic federation patternremote
generator should NOT have a--dynamic
flag, as it makes no sense for a remote itself. HOWEVER, the logic of adding the remote to a specified--host
SHOULD still take into account if the host app has been configured with dynamic federation in mind.