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
created a new nx workspace -npx create-nx-workspace@latest react-monorepo --preset=react-monorepo
created a shell app - nx g @nx/react:host shell --directory=apps/react/shell
created a remote app - nx g @nx/react:remote settings-app--directory=apps/react/settings-app
Created a simple demo (see repo) to host the remote app inside the host app
Updated module-federation.config.ts in the host and shell apps according to what I think is right from examples I've seen
started everything up locally - nx serve shell --devRemotes=settings-app
Issue
The small POC works fine if the remote app uses standard components (e.g. a standard button instead of an MUI Button in app.tsx)
However, if I use any @mui/material component I get an error. The remote app runs fine when served standalone but hosted inside the shell app gives - TypeError: Cannot read properties of null (reading 'useContext'). The call stack can vary but the top of the stack is always Object.useContext.
I am new to using NX and mono repos, which is why I've posted the steps I'd taken just in case it stands out that I've missed a step or misunderstood the concept behind host and remote apps and perhaps not a bug?
The code in the repo has been stripped right back to show a simple example of the issue I'm stuck with.
Expected Behavior
I expected to see the remote app (settings-app) hosted inside the host page, which I do if I avoid using MUI components.
Current Behavior
Steps to recreate..
Issue
I am new to using NX and mono repos, which is why I've posted the steps I'd taken just in case it stands out that I've missed a step or misunderstood the concept behind host and remote apps and perhaps not a bug?
The code in the repo has been stripped right back to show a simple example of the issue I'm stuck with.
Expected Behavior
I expected to see the remote app (settings-app) hosted inside the host page, which I do if I avoid using MUI components.
GitHub Repo
https://github.com/GDWhitehead/nx-monorepo-poc
Steps to Reproduce
Nx Report
Failure Logs
No response
Package Manager Version
No response
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: