manfredsteyer / module-federation-plugin-example

258 stars 177 forks source link

BrowserAnimationsModule doesn't work with Module Federation #16

Closed Ricky24595422 closed 3 years ago

Ricky24595422 commented 3 years ago

I am working on a module-federation prototype with webpack5 and nrwl12(monorepo). Basically, I have a host application, that loads a shared module from page b. That shared module should be used in the host then. It sets up a RouterModule.forChild() and is exposed via webpack. That works. Now I added one of our components, which uses animation inside and things are breaking. With the BrowserAnimationsModule imported in my shared module, the host app will not work anymore. The router will just add a new copy of my shared content underneath one another every time I navigate to it. I assume it creates a new platform everytime it loads the module, but how can I prevent that? I have also tried to share the @angular/platform-browser/animations across app and host, but without luck.

Ricky24595422 commented 3 years ago

use forRoot for root module and expose child module as remote module, the issue is gone.