angular-architects / module-federation-plugin

MIT License
715 stars 192 forks source link

Use startsWith matcher for react MFE routes #546

Open ninjabhishek opened 4 months ago

ninjabhishek commented 4 months ago

Hi,

I am using React MFE in Angular shell. matcher: startsWith(...) works well if the MFE is Angular too. What if react MFE has routes and I want to include them all in Angular shell? Tried using matcher but did not work

manfredsteyer commented 4 months ago

Hi,

Is your shell Angular and your MFE react?

ninjabhishek commented 4 months ago

@manfredsteyer yes. Shell is Angular 14 and MFE is React 17/18 typescript

manfredsteyer commented 4 months ago

So let's say the url that should make the shell to route to the react app looks as follows:

/react-mfe1/start

In this case, the Angular shell needs a matcher matching everything starting with /react-mfe1/

And the react app needs to have routes like

/react-mfe1/start /react-mfe1/further-route /react-mfe1/etc

Does this work?

Best wishes, Manfred

ninjabhishek commented 4 months ago

No it does not. It does not load any page, not even with '' as path (default page) when router is configured in react app

ninjabhishek commented 4 months ago

@manfredsteyer I am using react-router-dom in react app for routing. any suggestions on how to make this work?