-
Notifications
You must be signed in to change notification settings - Fork 228
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) Setup esm-form-entry
to use webpack module federation
#1168
Conversation
Size Change: -451 kB (-6%) ✅ Total Size: 6.73 MB
ℹ️ View Unchanged
|
esm-form-entry
to use webpack module federationesm-form-entry
to use webpack module federation
Yeah, I don't think SingleSPA's docs have kept up with Angular.
This works on my machine (with my tweaks) as is |
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.
Thanks @denniskigen! Excellent work!
Requirements
Summary
This PR sets up
esm-form-entry
to use webpack module federation (WMF). Presently, all the other frontend modules get loaded using webpack module federation, except for thisesm-form-entry
, which gets loaded using the legacy mechanism (System.import
).esm-form-entry
runs on Angular v12, which supports WMF. What needed adjustment is our webpack configuration.The approach I've used here leverages ngx-build-plus which gets provided by @angular-architects/module-federation. The single-spa docs recommend using @angular/builders to customize your build configuration. Still, I've not had much success trying to tweak it for this purpose. Setting things up with @angular-architects/module-federation was relatively straightforward on the other hand.
FWIW, the module federation organization on GitHub has many examples that use ngx-build-plus, so I think it's a sound choice.
I'm happy to get feedback on whether we should stick to using Angular builders and suggestions for what kind of tweaks we might need to make to the webpack configuration to support that.
Also FWIW, I've not found plenty of mentions of webpack module federation in the Angular builders repo, save for maybe this one issue.
NB: This PR requires openmrs/openmrs-esm-core#677 to work.