Slide 1

Slide 1 text

@ManfredSteyer ManfredSteyer

Slide 2

Slide 2 text

@ManfredSteyer Do you remember her?

Slide 3

Slide 3 text

@ManfredSteyer Software Engineering is a Team Sport

Slide 4

Slide 4 text

@ManfredSteyer Coordination b/w Teams

Slide 5

Slide 5 text

@ManfredSteyer Monolith Flight System

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

@ManfredSteyer Booking App Check-in App Boarding App Luggage App Microfrontends

Slide 8

Slide 8 text

@ManfredSteyer How to implement Microfrontends? ?

Slide 9

Slide 9 text

@ManfredSteyer Webpack 5 Module Federation

Slide 10

Slide 10 text

@ManfredSteyer Contents Consequences of Microfrontends Implementation with Module Federation When can we have it?

Slide 11

Slide 11 text

@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

Slide 12

Slide 12 text

@ManfredSteyer 1: Consequences of Microfrontends

Slide 13

Slide 13 text

@ManfredSteyer Booking App Check-in App Boarding App Luggage App Autonomous Teams

Slide 14

Slide 14 text

@ManfredSteyer Autonomous Teams Separate Development Separate Deployment Own architecture decisions Own technology descisions

Slide 15

Slide 15 text

@ManfredSteyer Microfrontends are first and foremost about scaling teams!

Slide 16

Slide 16 text

@ManfredSteyer Challenges

Slide 17

Slide 17 text

@ManfredSteyer Challenges UI Composition UI Consistency Bundle Size/ Sharing Dependencies Version Conflicts between Microfrontends …

Slide 18

Slide 18 text

@ManfredSteyer Module Federation Solves Some of Them! UI Composition UI Consistency Bundle Size/ Sharing Dependencies Version Conflicts between Microfrontends …

Slide 19

Slide 19 text

@ManfredSteyer 2: Webpack 5 Module Federation

Slide 20

Slide 20 text

@ManfredSteyer DEMO

Slide 21

Slide 21 text

@ManfredSteyer How to load separately compiled code?

Slide 22

Slide 22 text

@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!

Slide 23

Slide 23 text

@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')

Slide 24

Slide 24 text

@ManfredSteyer How to Get the Microfrontend's URL? Shell (Host) Microfrontend (Remote) RemoteEntrypoint.js

Slide 25

Slide 25 text

@ManfredSteyer How to Share Libs? Shell (Host) Microfrontend (Remote) shared: [ "@angular/core", "…" ] shared: [ "@angular/core", "…" ]

Slide 26

Slide 26 text

@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

Slide 27

Slide 27 text

@ManfredSteyer DEMO

Slide 28

Slide 28 text

@ManfredSteyer 3: When can we have it?

Slide 29

Slide 29 text

@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)

Slide 30

Slide 30 text

@ManfredSteyer Free eBook ANGULARarchitects.io/book Updated for Module Federation and Alternatives

Slide 31

Slide 31 text

@ManfredSteyer Conclusion Main Purpose of µFrontends: Scaling Teams Federation: Import From Other App Sharing Libs Take Care of Conflicts

Slide 32

Slide 32 text

@ManfredSteyer Be like Bonnie and think first! Evaluate whether you need µFrontends No: Majestic Monolith Yes: Consider Module Federation

Slide 33

Slide 33 text

@ManfredSteyer Contact and Downloads [web] ANGULARarchitects.io [twitter] ManfredSteyer d Slides & Examples Remote Company Workshops and Consulting