angular-architects / module-federation-plugin

MIT License
711 stars 188 forks source link

Dynamic loading remote from web-component #27

Closed floflojaja closed 3 years ago

floflojaja commented 3 years ago

Hi,

I'm currently work arround module federation and a microfrontend architecture.

I meet a problem when i want to load remote dynamically. In fact, your plugin (module-federation-plugin) allow us to load module but not web-component like when you expoded the "bootstrap.ts" file. When i try to retrieve the "./web-components" element from the container like this :

const container = window[remoteName]; const factory = await container.get(exposedElement); const Element = factory(); console.log(Element)

It is empty...

So you have an idea to solve this problem ?

Thanks

manfredsteyer commented 3 years ago

Hi,

thanks for pointing this out. This is currently not the focus of this plugin. However, you might find some answers here https://www.angulararchitects.io/aktuelles/multi-framework-and-version-micro-frontends-with-module-federation-the-good-the-bad-the-ugly/