core icon indicating copy to clipboard operation
core copied to clipboard

remotes initialized but is empty in other containers (federation runtime)

Open hosseinmd opened this issue 9 months ago • 3 comments

Describe the bug

i have called init method of federation runtime in main container(or host) import { init } from '@module-federation/runtime'; other containers doesn't know what the remotes are initialized in main container for solving this i add a patch to @module-federation/runtime-core

-            remotes: [],
+            remotes: CurrentGlobal.__FEDERATION__?.remotes || [],
             shared: {},

dev mode working after this change

to repreduce https://github.com/callstack/super-app-showcase in super-app-showcase remove remotes from ModuleFederationPluginV2 of all containers and add an init in host

Reproduction

https://github.com/callstack/super-app-showcase

Used Package Manager

npm

System Info

"@module-federation/enhanced": "0.8.7",

Validations

hosseinmd avatar Jan 29 '25 11:01 hosseinmd