Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Microfrontend Revolution Module Federation with Angular @techWebinarNepal

The Microfrontend Revolution Module Federation with Angular @techWebinarNepal

Manfred Steyer

September 13, 2020
Tweet

More Decks by Manfred Steyer

Other Decks in Programming

Transcript

  1. @ManfredSteyer Contents #1: Consequences of Microfrontends #2: Module Federation #3:

    Dynamic Module Federation #4: Version Mismatch #5: Possible Roadmap
  2. @ManfredSteyer Module Federation Solves Some of Them! UI Composition UI

    Consistency Bundle Size/ Sharing Dependencies Version Conflicts between Microfrontends …
  3. @ManfredSteyer Idea const Component = await import('http://other-app/xyz') Does not work

    with webpack/ Angular CLI Even lazy parts must be known at compile time!
  4. @ManfredSteyer Webpack 5 Module Federation Shell (Host) Microfrontend (Remote) //

    Maps Urls in // webpack config remotes: { mfe1: "mfe1" } // Expose files in // webpack config exposes: { Cmp: './my.cmp.ts' } import('mfe1/Cmp')
  5. @ManfredSteyer How to Get the Microfrontend's URL? Shell (Host) Microfrontend

    (Remote) RemoteEntrypoint.js <script src="…"></script>
  6. @ManfredSteyer How to Share Libs? Shell (Host) Microfrontend (Remote) shared:

    [ "@angular/core", "…" ] shared: [ "@angular/core", "…" ]
  7. @ManfredSteyer Dealing with Version Mismatch SemVer by Default: Highest compatiable

    version Fallback: Use own version Relaxing: Configure a range of accepted versions Singleton: Warning or error
  8. @ManfredSteyer Well … Webpack 5 is currently beta Shown examples:

    PoC w/ custom webpack conf + patched CLI lib CLI: Not before version 11 (fall 2020) Squeeze federation config into CLI's webpack config Custom Builder (e. g. ngx-build-plus)
  9. @ManfredSteyer Be like Bonnie and think first! Evaluate whether you

    need µFrontends No: Majestic Monolith Yes: Consider Module Federation