Pro Yearly is on sale from $80 to $50! »

The Microfrontend Revolution Module Federation with Angular @ngWarsaw June 2020

The Microfrontend Revolution Module Federation with Angular @ngWarsaw June 2020

15934fa2aa7b2ce21f091e9b7cffa856?s=128

Manfred Steyer

June 17, 2020
Tweet

Transcript

  1. @ManfredSteyer ManfredSteyer Angular Warsaw

  2. @ManfredSteyer Do you remember her?

  3. @ManfredSteyer Software Engineering is a Team Sport

  4. @ManfredSteyer Coordination b/w Teams

  5. @ManfredSteyer Monolith Flight System

  6. @ManfredSteyer Booking Service Check-in Service Boarding Service Luggage Service Microservices

    Sub-Domains (DDD)
  7. @ManfredSteyer Booking App Check-in App Boarding App Luggage App Microfrontends

  8. @ManfredSteyer How to implement Microfrontends? ?

  9. @ManfredSteyer Webpack 5 Module Federation

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

    Possible Roadmap
  11. @ManfredSteyer About me… Manfred Steyer, ANGULARarchitects.io (Remote) Angular Workshops and

    Consulting Google Developer Expert for Angular Trusted Collaborator in the Angular Team Manfred Steyer
  12. @ManfredSteyer #1: Consequences of Microfrontends

  13. @ManfredSteyer Booking App Check-in App Boarding App Luggage App Autonomous

    Teams
  14. @ManfredSteyer Autonomous Teams Separate Development Separate Deployment Own architecture decisions

    Own technology descisions
  15. @ManfredSteyer Microfrontends are first and foremost about scaling teams!

  16. @ManfredSteyer Challenges

  17. @ManfredSteyer Challenges UI Composition UI Consistency Bundle Size/ Sharing Dependencies

    Version Conflicts between Microfrontends …
  18. @ManfredSteyer Module Federation Solves Some of Them! UI Composition UI

    Consistency Bundle Size/ Sharing Dependencies Version Conflicts between Microfrontends …
  19. @ManfredSteyer #2: Webpack 5 Module Federation

  20. @ManfredSteyer DEMO

  21. @ManfredSteyer How to load separately compiled code?

  22. @ManfredSteyer Idea const Component = import('http://other-app/xyz') Does not work with

    webpack/ Angular CLI Even lazy parts must be known at compile time!
  23. @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')
  24. @ManfredSteyer How to Get the Microfrontend's URL? Shell (Host) Microfrontend

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

    [ "@angular/core", "…" ] shared: [ "@angular/core", "…" ]
  26. @ManfredSteyer Conflicting Shared Libs Option A: Reuse it anyway Option

    B: Load own Both might be bad Prevent organizationally (e. g. conventions, contracts, monorepos) Integration-Testing
  27. @ManfredSteyer DEMO

  28. @ManfredSteyer Possible Roadmap

  29. @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)
  30. @ManfredSteyer Free eBook ANGULARarchitects.io/book Updated for Module Federation and Alternatives

  31. @ManfredSteyer Conclusion Main Purpose of µFrontends: Scaling Teams Decoupling Federation:

    Import From Other App Sharing Libs Take Care of Conflicts
  32. @ManfredSteyer Be like Bonnie and think first! Evaluate whether you

    need µFrontends No: Majestic Monolith Yes: Consider Module Federation
  33. @ManfredSteyer Contact and Downloads [web] ANGULARarchitects.io [twitter] ManfredSteyer d Slides

    & Examples Remote Company Workshops and Consulting