vite icon indicating copy to clipboard operation
vite copied to clipboard

How can I connect an application with a newer version of react?

Open ohmygodismax opened this issue 1 year ago • 5 comments

When the module is dynamically connected via @module-federation/enhanced/runtime,, at the moment, when I try to use 2 different instances of the react library (an older version on the host application), I get an error: image

But the module federation instance shows that 2 react instances have been loaded: image

The problem is solved when using singleton, but this is not the behavior I expect.

ohmygodismax avatar Dec 11 '24 11:12 ohmygodismax

The problem is solved when using singleton, but this is not the behavior I expect.

Hi @ohmygodismax What's your expectation? Can you create a basic repo for this?

gioboa avatar Dec 11 '24 12:12 gioboa

Hi @gioboa Yes, something like this https://github.com/ohmygodismax/mf-vite-example

ohmygodismax avatar Dec 12 '24 05:12 ohmygodismax

@ohmygodismax I didn't have the time to look at it. Did you find a solution for that?

gioboa avatar Dec 20 '24 15:12 gioboa

@gioboa I was unable to use 2 versions of react with an older one in the host application. So far, I've settled on the option where the connection is via a singletone with a warning that the host application has an older version.

ohmygodismax avatar Dec 23 '24 04:12 ohmygodismax

I see, is your scenario working with webpack / rspack?

gioboa avatar Dec 23 '24 06:12 gioboa

As there's been no activity for 30 days, this issue has been flagged as stale. If you'd like it to remain open, please add a comment within the next 7 days. Thank you.

github-actions[bot] avatar Oct 29 '25 14:10 github-actions[bot]