You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had same problem and it's not how it works. You would have to pass the context as props to bridge component and create new context. Context is held within the app tree of react itself.
According to what I see, currently, the bridge component mounts to a separated dom element, and because of it, context doesn't work. But I need this proxy of react-router in my app. So I see a few solutions here:
Do not do it with separated node
Move the proxy of react-router functionality to a separate package to have the ability to use it independently
correct, you are mounting apps onto divs / nodes - like single spa, when using bridges - you cannot access memory singletons like context in this mode because they are essentially separate app trees
Describe the bug
It looks like there is an issue with context consumption when using the
@module-federation/bridge-react
package.I have apps:
core
- sharesNameProvider
component for all apps (NameProvider
is a react context's provider)host
- entry point app, usesNameProvider
and has remotes:core
,remote-a
,remote-b
.remote-a
andremote-b
- Apps that consume context fromcore
host/src/App.tsx
BridgeRemoteA
- displays brige approach export/importRemoteA
- displays "React.lazy + Suspense" importRemoteB
- displays sync importResult:

Also, there are some issues with
dynamic-remote-type-hints-plugin
:Reproduction
https://github.com/intpp/rsbuild-module-federation-playground
Used Package Manager
pnpm
System Info
Validations
The text was updated successfully, but these errors were encountered: