Search code examples
reactjsangularwebpack-module-federation

Using Webpack 5's Module Federation, is it possible for the shell written in react to host or load an angular component?


We're creating a web app written in Angular that will be embedded/loaded from another web app written in React. I'm not sure if this will work using webpack 5's module federation.

Given that module federation is simply loading a JavaScript module asynchronously at runtime instead of build time (correct me if I'm wrong), am I right to assume that it would only work only if I could make Angular work within React without using module federation?

Let's assume that Angular can never work within react, is it correct to assume that it won't also work when using module federation?

Any working example is appreciated.


Solution

  • As I understand this should be possible. You could provide your Angular apps as web-components and share them through module federation.

    Your shell application would need more logic to handle the routing. Maybe this article will help you: https://www.angulararchitects.io/en/aktuelles/multi-framework-and-version-micro-frontends-with-module-federation-the-good-the-bad-the-ugly/