-
-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting react hooks error in the host application - Cannot read properties of null (reading useEffect) #2898
Comments
Upgrade detail commit: 2heal1/next-mf-poc@5b36d48 |
sorry i forget to set registry , you need to delete |
I fix lockfile and push again , @a-utkarsh you can try again |
Hi @2heal1 thanks, it worked. But can you please tell me, is there anyway I can do the same with the older version of module federation in the host. I don't want to modify anything the host application. In my use case, both host and remote application independently gets deployed. That's why I don't want to change anything in host app |
Hmm i'm afraid it can not , because host use |
@ScriptedAlchemy , do you have any ideas to solve this issue ? They just use mf 1.0 + next.js |
You are missing getInitialProps or get server props. https://module-federation.io/practice/frameworks/next/index.html You must have a data method on document and app at least, otherwise it will SSG and there will be no react to begin with. |
Id also suggest upgrading from v6 to v8 |
Describe the bug
Getting the hooks error when tries to load a remote component running on the latest version of React, Next and nextjs-mf.
Scenario
Host running on older version:
module federation : 6.2.3,
next:12.2.0,
react: 17.0.2
Remote running on the latest version of all the above packages.
My remote application works in standalone mode, as well as some of the components are exposed via mf, and consumed by host.
The problem is, I am either able to run the host application or the remote application.
If I make the shared config of remote to {}, I am able to run the remote application but get the error in the host application.
If I make the shared config as this
I get the react not found error in the remote application but my host works in this case.
P.S: I can't update the host packages to latest version as it loads many other modules, which starts breaking.
Reproduction
https://github.com/a-utkarsh/next-mf-poc.git
Used Package Manager
npm
System Info
Validations
The text was updated successfully, but these errors were encountered: