Angular Module Federation Micro-FE Speed Run

Поділитися
Вставка
  • Опубліковано 9 лют 2025

КОМЕНТАРІ • 63

  • @Abelfubu
    @Abelfubu 3 роки тому +12

    That was awesome! Please more content on angular would be great!!!! 🤩

  • @william3588
    @william3588 3 роки тому +2

    Love the content and your introductions out on the wilderness!

  • @Henverx
    @Henverx 3 роки тому +2

    A great channel and a great, calm engineer. Thanks!

  • @migom6
    @migom6 3 роки тому +9

    Waiting eagerly for react micro FE speed run

  • @CoulissesTech
    @CoulissesTech 3 роки тому +2

    Awesome tutorial..Thanks a lot for sharing this with the community

  • @philykearney
    @philykearney 3 роки тому +1

    Can't wait for the React / NX version. 👍
    Great video Jack. 👌🏻

  • @DjDeepHouse
    @DjDeepHouse 3 роки тому +1

    Really great content. Thank you!

  • @ahammadalipk
    @ahammadalipk 3 роки тому +1

    Great ,as always Jack

  • @alwaysSaiKiran
    @alwaysSaiKiran 2 роки тому +1

    Crisp & Clear

  • @1235niki
    @1235niki 3 роки тому +1

    Thanks Jack 😊

  • @ahammadalipk
    @ahammadalipk 3 роки тому +3

    I have tried with angular 9 and with multi repo approach as our team has different teams have their won deliverables. Tried to set it up with custom webpack without cli as my organisation didn’t support yarn.will be really helpful if you could give me an advise. For now we put on hold as we are having issues with scss file sharing

  • @daviddonadze221
    @daviddonadze221 3 роки тому +1

    Thank u so much

  • @souravkumarpaul
    @souravkumarpaul 2 роки тому +1

    If that component depends on some external 3rd part module then how would I be able to expose it and how to use it in the host container?

  • @sourav_-_7038
    @sourav_-_7038 3 роки тому +1

    i want to use react for the container application and angular components on that react container? can you do a video on that?

  • @marcomoi8787
    @marcomoi8787 3 роки тому +1

    Waiting your tutorial for Next.js with Module Federation :-)

  • @ahamza007
    @ahamza007 3 роки тому +1

    Great!! Thank you Jack. Can this module federations be applied to react native components as well? If so, can you please do a video on that. Thank you

  • @Balance-8
    @Balance-8 3 роки тому +1

    yea can you do this with nextjs and react + tailwind that would be really helpful. Maybe dive deeper into the benefits of micro front ends? Thanks again! love your content

  • @bigk9000
    @bigk9000 8 місяців тому

    What is the sidebar extension you're using that's right above Nx Console, as well as the one that's right above Live Share?

  • @rogercondorilarico3323
    @rogercondorilarico3323 2 роки тому

    Hello Jack, very good contribution, but I wanted to ask you if it is possible to share components as a utility module so that other components reuse the selectors of the shared component is it possible in angular?

  • @GabrieleMilanItalia
    @GabrieleMilanItalia 3 роки тому +1

    Nice! :-)

  • @JasonRAN0
    @JasonRAN0 3 роки тому +1

    Thank you Jack. I am trying to setup my own module federation using React / Nx. Would love to see your setup. Beside that, integrate with single-spa to handle the rendering/routing to different pages?

    • @jherr
      @jherr  3 роки тому

      Cool. But can you let me know what Single SPA is doing in this scenario?

    • @JasonRAN0
      @JasonRAN0 3 роки тому +1

      ​@@jherr Let's say if I have multiple mfe apps which each app has its own router. Currently, I have my own customization to handle the routing on my container app and control when to show/not show it. Also, create a mount function for the container to attach it to the DOM.
      In single-spa, it seems it has features on handling routing/ui rendering and the app lifecycle. However, I haven't got a chance to try single-spa yet. So please correct me if I am wrong.

    • @jherr
      @jherr  3 роки тому +1

      @@JasonRAN0 I'm sure Angular has some excellent router options that you can use. The big advantage of Single SPA is that it allows for you to mix in micro-FEs from different tech stacks. But if you aren't going to be doing that you don't need to add the overhead of wrapping your Angular components as Single SPA parcels and then only to unwrap them back into an Angular host app.

  • @louisyt2355
    @louisyt2355 Рік тому

    What is the command in your video at 5:31?

  • @rzzo
    @rzzo 3 роки тому +1

    Awesome video! Wondering if you can post an update on this using Angular 13? I tried to convert this but cannot get the new Dynamic Component to load

    • @jherr
      @jherr  3 роки тому +1

      I've been experimenting with Angular 13, the documentation says to use `viewContainerRef.createComponent` for dynamic components, but the API itself says that method is deprecated and there is a different way to do it in 13. I'm confused.

    • @rzzo
      @rzzo 3 роки тому +1

      @@jherr That’s exactly what I was running into and have not been able to get it to actually load the carousel dynamically

    • @jherr
      @jherr  3 роки тому

      @@rzzo Well, good news then, I've got that working. I'm just concerned that now I'm not doing it the "Angular way" (which is like the "Chicago way" but with less guns.) j/k Anyway, jump on the Discord server and hit me up in the Angular channel. I can shoot you over my working code you can see if it's ok or if I need to talk with Manfred to figure out what the "Angular way" is.

    • @rzzo
      @rzzo 3 роки тому

      @@jherr Hahaha! I think I will be using that "Chicago Way" from here on out! I joined the Angular community and Angular discord channels but I am not seeing your name, do you go by something else on there?

    • @jherr
      @jherr  3 роки тому

      @@rzzo Ah, I meant my server: discord.gg/HkvRaQCN

  • @avantijundare
    @avantijundare Рік тому

    Hey ... thank you for the video this works completely fine in local , but as soon as i push host and remote on cloud platform, it is giving CORS error while calling the remote application .Can you pease help to resolve this issue , both application is bootstrapped using ng serve .

  • @kebosiwaeosi-osi818
    @kebosiwaeosi-osi818 3 роки тому +2

    Great Sharing..!!!
    please advice, I have a question, if we create it on angular 13. i got this error on CarouselHostComponent ==>
    error TS2322: Type 'ComponentRef' is not assignable to type 'ComponentRef'
    any issue with angular 13 ??

    • @jherr
      @jherr  3 роки тому

      Sounds like just a basic TypeScript issue. You are trying to set something of type `ComponentRef` to `ComponentRef`, so you probably need to cast that.

    • @bhagwaticharanmishra2962
      @bhagwaticharanmishra2962 2 роки тому

      This is angular 13 issue. ComponentFactoryResolver is deprecated in Angular 13

    • @davle123456789
      @davle123456789 2 роки тому

      @@bhagwaticharanmishra2962 I got errors after I try this in Angular 13: import {
      Component,
      OnInit,
      //ComponentFactoryResolver,
      ViewContainerRef,
      ComponentRef,
      } from '@angular/core';
      import { loadRemoteModule } from '@angular-architects/module-federation';
      @Component({
      selector: 'ang-pokemon-mfe-carousel-host',
      templateUrl: './carousel-host.component.html',
      styleUrls: ['./carousel-host.component.scss'],
      })
      export class CarouselHostComponent implements OnInit {
      constructor(
      //private cfr: ComponentFactoryResolver,
      private vcref: ViewContainerRef
      ) {}
      async ngOnInit() {
      const { PokemonCarouselComponent } = await loadRemoteModule({
      remoteEntry: 'localhost:4201/remoteEntry.js',
      remoteName: 'search',
      exposedModule: './CarouselComponent',
      });
      const componentRef: ComponentRef = this.vcref.createComponent(
      //this.cfr.resolveComponentFactory(PokemonCarouselComponent)
      PokemonCarouselComponent
      );
      componentRef.instance.search = 'p';
      }
      }

    • @bhagwaticharanmishra2962
      @bhagwaticharanmishra2962 2 роки тому

      @@davle123456789 this is because component ref related stuffs are deprecated in angular 13

  • @socrateshlapolosa2020
    @socrateshlapolosa2020 2 роки тому

    Greetings Jack. Assume all the logic (api call etc) in the PokemonCarouselComponent was refactored into a PokemonCarouselService so that the component had a dependency on the service. how would this be exposed such that hosts would consume the remote component only (and it would transitively import the service dependency). is this even the correct approach?

  • @rajathvenkatesh3253
    @rajathvenkatesh3253 2 роки тому

    I am looking to share services and make them as singletons to be used between my shell and micro front ends in angular.
    I have multi repo MFEs so NX share libraries would not be a good option.

  • @Ghruuul
    @Ghruuul 3 роки тому +1

    I would be interested what the strategy is to use MicroFEs and Module Federation in production. There are missing pieces at the moment.

    • @jherr
      @jherr  3 роки тому

      Does this help? ua-cam.com/video/MU8_LP8R_ZI/v-deo.html

    • @Ghruuul
      @Ghruuul 3 роки тому

      @@jherr Yes that covers some part, thank you.
      I would be curious how larger companies would tacke module federation. Generally these companies have multiple teams working on multiple projects and a centralized team creating components the main flair of module federation is gone (where allowing to import between projects is possible).
      If a core team worked on components for the projects you end up with federated modules being centralized into a one project. Thus being close to having a repository like for web components, open components, parcels, pilets, etc. But I guess this isn't the purpose of the federated modules.
      Regardless of centralization or not, federated modules would have a contract for each version being used, that is fine. And where you'd fetch the federated modules would also be versioned.
      So I'm not sure what other advantages federated modules brings to companies having this type of organization.
      Also many thank you for your contributions to the MFE world, you breaking things down to their essence is crazy good where these new technologies are constantly growing.

    • @jherr
      @jherr  3 роки тому +1

      @@Ghruuul Thanks for the thoughtful reply. You have to work to make federated modules versioned. The big win of establishing these "runtime dependencies" using something like federated modules, or anything else, is that you can update parts of the application without re-building and re-deploying the host application. A good example is a header/footer where you have multiple applications that include the header/footer and you want them all to show the new header/footer as soon as its updated. With a build time dependency you'd have to build them all and then roll them all out at the same time. With a runtime dependency, you update the runtime dependency and you're done. Of course, there is an associated risk there.

    • @Ghruuul
      @Ghruuul 3 роки тому +1

      @@jherr ​ Thank you. Maybe the big challenge is how to "force" a newer version of a federated module respect the contract that has been implemented. The advantage is clear, loading modules runtime from another application without needing to publish the parts somewhere is definitely awesome.

    • @jherr
      @jherr  3 роки тому +1

      @@Ghruuul So what I propose is to have a shared NPM module with the TypeScript types that the host expects and that the remote module must follow. And that NPM module is consumed at build time by both. So then later as new optional fields are updated they are first supported in the host and then accepted in the remote module, and that will give you a safe upgrade path. If it's followed. There is no runtime guarantee.

  • @YonathanBenitah
    @YonathanBenitah Рік тому

    Sharing microfrontend within the same monorepo isn't a big deal.
    Next step would be to share components and states between microfrontends that are not in same repo

  • @lucasgiunta8874
    @lucasgiunta8874 Рік тому

    Maybe my question is stupid, but it will work with angular cli instead of nx ?

    • @jherr
      @jherr  Рік тому

      It should, yes.

  • @vineetkaushik5044
    @vineetkaushik5044 2 роки тому

    Anyway we can expose mixins for consumption by the host from a remote application?

    • @jherr
      @jherr  2 роки тому

      If it's an executable piece of JavaScript code it can be exposed.

    • @vineetkaushik5044
      @vineetkaushik5044 2 роки тому

      @@jherr I see, so sass/scss mixins are a no-go? I have a particular problem - my remote project needs to be themed according to my host project's color palette. If there was a way I could pull in the mixins with the color styles from my remote project and pass my palette from the host into those mixins, that would be perfect

    • @jherr
      @jherr  2 роки тому

      @@vineetkaushik5044 Module Federation can't directly handle CSS files. To share CSS it needs to be implemented using some type of CSS in JS, because only JavaScript code can be federated.

  • @oleksandrsanzharevskyy
    @oleksandrsanzharevskyy Рік тому

    does it mean, if you have N components, and you wanna to use them as MFE, you need to serve all of N components?

    • @jherr
      @jherr  Рік тому +1

      Probably yeah. It's not actually overhead because it just means splitting out those components into a different bundle. Which doesn't mean replication. It just means your app will be code split additionally along the MFE sharing lines as well as any other code splitting you are doing.

    • @oleksandrsanzharevskyy
      @oleksandrsanzharevskyy Рік тому

      @@jherr thanks for your answer! so if i understood correctly, it makes sense, only if you have an existing application and you're exporting one/some components as MFE. But it doesn't make sense to create, let say UI library as MFEs because it will require some servers to serve the apps. Or you can build them and serve as a static content?

    • @jherr
      @jherr  Рік тому +1

      @@oleksandrsanzharevskyy No. I know that I demonstrate MFEs on running servers, but you don't need servers to deploy MFEs. Federated Modules are just static JavaScript files that SHOULD be deployed on static asset stores or CDNs.

    • @oleksandrsanzharevskyy
      @oleksandrsanzharevskyy Рік тому

      @@jherr that's make sense. Thank you for your answer and great tutorials!

  • @gorakhborude447
    @gorakhborude447 5 місяців тому

    it could be more informative if you could have explain contents of webpack line by line , you just jumped on plugin section

  • @samdomville1873
    @samdomville1873 2 роки тому

    Why do I have to import all the same app.modules.ts imports from the search app into the home app app.modules.ts? Why doesn't module federation have the remote app bring things over encapsulated? That feels like it's tightly coupled :(