module-federation-examples icon indicating copy to clipboard operation
module-federation-examples copied to clipboard

Next14 Host / React Remote - Prod Eager Consumption Error On Load

Open xparnie opened this issue 1 year ago • 1 comments

Howdy all,

Setup:

Our host applications are built in Next while our remote is built in React. I helped build the remote and we've been asked to update to support Next 14. I set up the same scenario we're seeing using the module-federation-examples/nextjs-react application in the following repo. Link to Repo

Packages: NextJS: 14.0.4 Next-mf: 8.1.3

You'll have to cd into the host and remote to npm i.

Remote: npm run dev Host: A) npm run dev OR B) npm run build && npm run start

Issue:

If you use method A to start the host, everything works without issue.

But, when you use method B you encounter a eager consumption error on initial load. The weird part is when you refresh the error goes away. To replicate after initial load, I check 'Disable Cache' in the network tab in the DevTools. I imagine it's a race condition of some kind. It's a difference between dev and production build throwing the eager consumption issue, but I don't know what.

Other than this issue, the applications are working flawlessly, so hopefully a solution can be found.

Thanks in advance for any help anyone can provide.

Cheers

xparnie avatar Jan 04 '24 23:01 xparnie

update to next tag if 8.0.5 still has issue, will release 8.0.6

ScriptedAlchemy avatar Jan 14 '24 03:01 ScriptedAlchemy