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

The Microfrontend Revolution Module Federation ...

The Microfrontend Revolution Module Federation with Angular @ngGraz 10/2020

Manfred Steyer

October 15, 2020
Tweet

More Decks by Manfred Steyer

Other Decks in Programming

Transcript

  1. @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!
  2. @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')
  3. @ManfredSteyer How to Get the Microfrontend's URL? Shell (Host) Microfrontend

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

    [ "@angular/core", "…" ] shared: [ "@angular/core", "…" ]
  5. @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
  6. @ManfredSteyer Example for SemVer and Fallback • Shell: my-lib: ^10.0.0

    • MFE1: my-lib: ^10.1.1 • MFE2: my-lib: ^9.0.0 Result: • Shell and MFE1 share ^10.1.1 • MFE2 falls back to its own version ^9.0.0
  7. @ManfredSteyer When can we have it? Webpack 5 and Module

    Federation: final Angular CLI must support webpack 5 too Angular CLI 11 (Beta) allows to opt into webpack 5 Angular CLI 11 ? (fall 2020)