Closed a-utkarsh closed 3 weeks ago
Upgrade @module-federation/nextjs-mf@8.4.13
and set shareStrategy as loaded-first
, the issue should be fixed
detail commit: https://github.com/2heal1/next-mf-poc/commit/5b36d480750f82a5fcc6a1d7eff7db13c3008132
sorry i forget to set registry , you need to delete webpack
from your package.json , i will push again . Cause the reply includes internal domain , i will delete this reply
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 @module-federation/nextjs-mf@6.2.3
which is not using mf 2.0 , so many features can not work
@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 Whatever the problem is, will not be retroactively fixed and alot has changed since v6 - but at a glance the problem is you have no data methods in the pages so theres no react on the server
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