angular-architects / module-federation-plugin

MIT License
725 stars 196 forks source link

Is it possible to use the shell app angular version @12 & other child/shared mfe's @v13 #158

Open Ravi-Royal-143 opened 2 years ago

Ravi-Royal-143 commented 2 years ago

I am using child mfe which needs to be updated to the angular version 13 but the shell app is still in angular version 12 which will be updated later on is this possible. it's throwing some console error "Cannot read properties of undefined ( reading 'init' )

bharathmuppa commented 2 years ago

I tried shell app with angular app version 13 and remote app with angular 12 that works absolutely fine. But other way is throwing same error as you mentioned.

manfredsteyer commented 2 years ago

Hi,

yes, that should be possible. Just make sure, you have the newest version of this Plugin. However, if you have Angular 12, you need to install ngx-build-plus version 12 (if you have Angular 13, you need to install ngx-build-plus version 13).

Also, for loading Angular 12, use type: 'script' and for loading Angular 13 use type: 'module'.

Please note, in this case you have also to bootstrap both Angular versions. This can come with some difficulties. This package can help here:

https://www.npmjs.com/package/@angular-architects/module-federation-tools

Best wishes, Manfred

Ravi-Royal-143 commented 2 years ago

Hi attached screenshot for reference image

Repo: for shell app: angular12-microfrontends for child app: https://github.com/manfredsteyer/module-federation-plugin-example

To start the app change done: 1) In module-federation-plugin-example changed all ports from 3000 to 4201. 2) In module-federation-plugin-example -> npm run start:mfe1 3) In angular12-microfrontend -> npm run start:shell