How to config a react vite project to microfrontend approach using dynamic remotes from module federation? #3252
-
I have a project that uses react and vite, and I set up a microfrontend approach using @module-federation/vite to get the remotes, also in the remotes the same stack and config. Now I want to dynamic remotes from module federation to be able to load remotes in runtime. According to module federation docs it's not possible with this plugin but it can be done using Federation Runtime. For the host app this is the load remote
To use the remote component:
The configuration in vite for the host component is set for dummy remote:
And this is the vite.conf.ts
The build is working fine in host, but when I open the application in the browser I get this error:
I tried changing the configuration in remotes and host following this example repo: https://github.com/RussellCanfield/nx-rspack-microfrontend-demo/blob/dynamic-loader/apps/mfe-monorepo/src/app/features/Home/components/Home.tsx Did some of you try this dynamic remote approach in vite? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Remote type is missing from init. Type should be set to module so runtime knows what format the remote is in and can handle it accordingly |
Beta Was this translation helpful? Give feedback.
Remote type is missing from init. Type should be set to module so runtime knows what format the remote is in and can handle it accordingly