[GH-ISSUE #533] feat: streamline vinext + module-federation/vite #109

Open
opened 2026-05-06 12:37:18 +02:00 by BreizhHardware · 1 comment

Originally created by @gioboa on GitHub (Mar 13, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/533

Hi, congratulations for this amazing project. 👏

I created an example using @module-federation/vite, and everything works fine. Here is the code

However, I ran into the problem of having multiple react instances at runtime.
I found a workaround, the idea is to have a method that exposes the host react instance for consumers.

I took inspiration from the Nuxt API useNuxtApp.
With Nuxt, for example, you can use const { $pinia } = useNuxtApp(); to retrieve the unique state instance and use that one inside multiple applications.

Would you mind thinking about a public API to support this scenario?

Originally created by @gioboa on GitHub (Mar 13, 2026). Original GitHub issue: https://github.com/cloudflare/vinext/issues/533 Hi, congratulations for this amazing project. 👏 I created an example using [@module-federation/vite](https://www.npmjs.com/package/@module-federation/vite), and everything works fine. Here is the [code](https://github.com/gioboa/module-federation-vite-examples/tree/main/vinext) However, I ran into the problem of having multiple react instances at runtime. I found a workaround, the idea is to have a method that exposes the host react instance for consumers. I took inspiration from the Nuxt API [useNuxtApp](https://nuxt.com/docs/4.x/api/composables/use-nuxt-app). With Nuxt, for example, you can use `const { $pinia } = useNuxtApp();` to retrieve the unique state instance and use that one inside multiple applications. Would you mind thinking about a public API to support this scenario?
Author
Owner

@southpolesteve commented on GitHub (Mar 16, 2026):

Woah! That is super cool. Yeah I am definitely open to it. Feel free to suggest what this should look like

<!-- gh-comment-id:4067678128 --> @southpolesteve commented on GitHub (Mar 16, 2026): Woah! That is super cool. Yeah I am definitely open to it. Feel free to suggest what this should look like
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#109
No description provided.