Slide 1

Slide 1 text

@ManfredSteyer ManfredSteyer Micro Frontends with Module Federation in Angular 12 Manfred Steyer, ANGULARarchitects.io

Slide 2

Slide 2 text

@ManfredSteyer Contents #1: Module Federation 101 #2: What's new for MF & Angular 12 #3: Future Features

Slide 3

Slide 3 text

@ManfredSteyer Manfred Steyer

Slide 4

Slide 4 text

@ManfredSteyer

Slide 5

Slide 5 text

@ManfredSteyer Micro Frontends

Slide 6

Slide 6 text

@ManfredSteyer

Slide 7

Slide 7 text

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

Slide 8

Slide 8 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 9

Slide 9 text

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

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

@ManfredSteyer 1) ng add @angular-architects/module-federation 2) Adjust generated configuration 3) ng serve

Slide 12

Slide 12 text

@ManfredSteyer

Slide 13

Slide 13 text

@ManfredSteyer

Slide 14

Slide 14 text

@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

Slide 15

Slide 15 text

@ManfredSteyer Better Monorepo Support Share like npm package

Slide 16

Slide 16 text

@ManfredSteyer Big Thanks to Webpack's Tobias Koppers

Slide 17

Slide 17 text

@ManfredSteyer Better Monorepo Support Migrate from Angular 11? Have a look on how we generate the webpack.config.js in Version 12

Slide 18

Slide 18 text

@ManfredSteyer npm run run:all

Slide 19

Slide 19 text

@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

Slide 20

Slide 20 text

@ManfredSteyer Tutorial is Updated https://www.npmjs.com/package/@angular-architects/module-federation

Slide 21

Slide 21 text

@ManfredSteyer Make sure you use Version ^12 for Angular 12!

Slide 22

Slide 22 text

@ManfredSteyer

Slide 23

Slide 23 text

@ManfredSteyer

Slide 24

Slide 24 text

@ManfredSteyer Evolution, not Revolution! Keep Track with upcoming Angular CLI versions Small Features to automate repetitive tasks

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

@ManfredSteyer Conclusion Loading Separately Deployed Code Better Monorepo Support Multi Repos supported too! run:all More to come!

Slide 27

Slide 27 text

@ManfredSteyer d Slides & Examples Remote Company Workshops and Consulting http://angulararchitects.io