manfredsteyer / module-federation-plugin-example

264 stars 182 forks source link

Navigation between micro frontends with web-components does not work #44

Open TCar10s opened 6 months ago

TCar10s commented 6 months ago

While testing the ng-web-component-mixed branch, I found failures in the navigation between microfrontends, but the navigation from shell to microfrontend works correctly.

Initially to be able to navigate from the host to the microfrontends I had to share the remoteEntry to the WrapperComponent:

Screenshot 2024-03-13 at 4 50 19 PM

If the remoteEntry is not added, the following error is generated: image

Well, with the remoteEntry added and trying to navigate between microfrontends, the URL changes but the component does not load, it seems that the navigation is trying to resolve to the origin microfrontend (I also made use of the connectRouter function that Mandred Steyer shares with us):

Screen Recording 2024-03-13 at 5 09 33 PM (3)

According to the analysis carried out, navigation from a microfrontend without web-component to the host or to another microfrontend with web-component works well, but navigation from a microfrontend with web-component to an external route (host or another microfrontend) does not work.

Has anyone been able to solve this problem with navigation to external routes using microfrontends with web-component? Thank you

davishooly commented 5 months ago

Hi @TCar10s, I'm facing a similar issue.. navigation between the main shell app and a micro-frontend functions correctly. However, when navigating within the micro-frontend using a link defined in the shell app (my navigation menu resides in the shell app), the URL updates but the UI does not reflect the change. For example, going from localhost:4200/shell-app -> localhost:4200/remote-app/landing works, but transitioning from localhost:4200/remote-app/landing -> to localhost:4200/remote-app/about fails.

Greech commented 1 month ago

Are you sure you want to navigate directly from MFE to MFE? I think the proper way of navigating between MFE should be done using shell.