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

Federated Angular – Why and How? @AngularMaster @ngPoland

Federated Angular – Why and How? @AngularMaster @ngPoland

15934fa2aa7b2ce21f091e9b7cffa856?s=128

Manfred Steyer
PRO

May 19, 2021
Tweet

Transcript

  1. @ManfredSteyer ManfredSteyer Federated Angular – Why and How? Manfred Steyer,

    ANGULARarchitects.io
  2. @ManfredSteyer Which one is the best?

  3. @ManfredSteyer It’s all about consequences in your very situation!

  4. @ManfredSteyer Micro Frontends

  5. @ManfredSteyer Micro Frontends

  6. @ManfredSteyer Contents #1 Why: Real-World Case Studies #2 How: Module

    Federation #3 What: New Features
  7. @ManfredSteyer Manfred Steyer

  8. @ManfredSteyer

  9. @ManfredSteyer Deadalus Health Care (formerly AGFA Health Care)

  10. @ManfredSteyer DATEV eG (~8000 Employees, 200 Products)

  11. @ManfredSteyer Huge European Bank Domain A Domain B Domain C

    Domain D Domain E Domain F eBanking
  12. @ManfredSteyer Another Huge European Bank Details from Domain A Customer

    Relationship Management Domain A Customer XYZ Domain B Domain C
  13. @ManfredSteyer Quality Bytes (No Micro Frontends but Domain Cutting)

  14. @ManfredSteyer Reasons for Micro Frontends Huge Product/ Product Suite Scaling

    Teams & Domains Switching out Technologies Rapitely Changing Requirements
  15. @ManfredSteyer Consequences Effort for „Meta Framework“ Sharing Code at Runtime

    and Bundle Size Common Look and Feel
  16. @ManfredSteyer

  17. @ManfredSteyer Booking App Booking App Check-in App Check-in App Boarding

    App Boarding App Luggage App Luggage App 1st Step: Domain Slicing
  18. @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!
  19. @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')
  20. @ManfredSteyer How to Get the Microfrontend's URL? Shell (Host) Microfrontend

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

    [ "@angular/core", "…" ] shared: [ "@angular/core", "…" ]
  22. @ManfredSteyer 1) ng add @angular-architects/module-federation 2) Adjust generated configuration 3)

    ng serve
  23. @ManfredSteyer

  24. @ManfredSteyer

  25. @ManfredSteyer Webpack 5 is Backed Into CLI 12 No need

    for forcing the CLI into webpack 5 anymore: "resolutions": { "webpack": "^5.0.0" }, Feel free to use yarn or npm
  26. @ManfredSteyer Better Monorepo Support Share like npm package

  27. @ManfredSteyer Big Thanks to Webpack's Tobias Koppers

  28. @ManfredSteyer npm run run:all

  29. @ManfredSteyer Booking Booking Boarding Boarding Shared Shared Feature Feature Feature

    Feature Feature Feature Feature Feature Feature Feature … … … … … … … … … … … … … … … … … … Booking App Booking App Boarding App Boarding App Btw: Also Works Perfectly w/ Multiple Repos Repository n Repository 2 Repository 1
  30. @ManfredSteyer Make sure you use Version ^12 for Angular 12!

  31. @ManfredSteyer Reduce Boilerblate for Common Tasks!

  32. @ManfredSteyer Web Components Support for Module Federation

  33. @ManfredSteyer Reason

  34. @ManfredSteyer

  35. @ManfredSteyer

  36. @ManfredSteyer Evolution, not Revolution! Keep Track with upcoming Angular CLI

    versions More Web Components Support SSR Support Tools for Reducing Boilerplate
  37. @ManfredSteyer Conclusion No free Lunch: Consequences Scaling Teams & Domains

    Module Federation
  38. @ManfredSteyer

  39. @ManfredSteyer d Slides & Examples Remote Company Workshops and Consulting

    http://angulararchitects.io