Closed leondavidtb closed 5 months ago
What's your host look like? Or the pages / files you're importing. Can you send screenshot
We're using a <DynamicComponent />
in the [[...url]].tsx, thats contain some functions and one of these function is responsible for render the MFE.
We are passing the type of the component, i.e., 'header':
and then render it like this:
Use react lazy not dynamic.
This is a attempt using dynamic to test, with lazy the same problem still remains.
Try adding a get initial props or something to document or a page and see if it works
Yes, we already use getInitialProps in _document.tsx.
Send me a github repo
Describe the bug
We are working on a project using Microfrontends architecture using the module federation plugin for nextjs v8.1.1 and we have 4 MFEs created: A, B, C and D. Of these 4 MFEs, we use MFE A to assemble the other MFEs. To run the project locally we need to download all the repositories and run them individually and point to their local address. For example: MFE-A-URL=http://localhost:3000 MFE-B-URL=http://localhost:3001 MFE-C-URL=http://localhost:3002 MFE-D-URL=http://localhost:3003
This will be a problem when we have other MFEs as it will become unfeasible to run multiple MFEs locally. Our idea is to run just the MFE-A that mounts all the other MFEs locally and point the other MFEs to their remote URLs, for example: MFE-A-URL=http://localhost:3000 MFE-B-URL=https://example.com/mfe-b MFE-C-URL=https://example.com/mfe-c MFE-D-URL=https://example.com/mfe-d
This is working correctly when pointing two MFEs, but when pointing the third it is giving the error shown in the image.
Reproduction
N/A
Used Package Manager
yarn
System Info
Validations