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

Multi-Framework Micro Frontends w/ Module Federation and Web Components @ReliableWebSummit2021

Multi-Framework Micro Frontends w/ Module Federation and Web Components @ReliableWebSummit2021

Please find the example and the source code here:
https://www.npmjs.com/package/@angular-architects/module-federation-tools

Manfred Steyer

August 26, 2021
Tweet

More Decks by Manfred Steyer

Other Decks in Programming

Transcript

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

    App Boarding App Luggage App Luggage App Micro Frontends
  2. @ManfredSteyer Booking App Booking App Check-in App Check-in App Boarding

    App Boarding App Luggage App Luggage App One Reason: Migrating Step by Step (1) (1) (2+) (2+)
  3. @ManfredSteyer Booking App Booking App Check-in App Check-in App Boarding

    App Boarding App Luggage App Luggage App Onother Reason: Merger
  4. @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')
  5. @ManfredSteyer How to Share Libs? Shell (Host) Microfrontend (Remote) shared:

    [ "@angular/core", "…" ] shared: [ "@angular/core", "…" ]
  6. @ManfredSteyer Custom Elements class MyElement extends HTMLElement { connectedCallback() {

    this.innerHTML = '<b>Hello World!</b>' } } customElements.define('my-element', MyElement);
  7. @ManfredSteyer Custom Elements class MyElement extends HTMLElement { connectedCallback() {

    ReactDOM.render(<App/>, this); } } customElements.define('my-element', MyElement);
  8. @ManfredSteyer Dynamically Adding a Web Component const script = document.createElement('script');

    script.src = 'assets/bundle.js'; document.body.appendChild(script); const myElement = document.createElement('myElement'); myElement['visible'] = true; document.body.appendChild(myElement);
  9. @ManfredSteyer Conclusion You Need a Good Reason! Module Federation: Sharing

    Code Web Components: Hiding Frameworks and Versions