Great article. How can you import the hooks from another remote? It would fail if It is dynamic
Hi Alibek,
Have you tried using NextJs SSG (Static site generation). we are able to create a next app with SSG and it was running fine with production build (ex: out folder). however when we try to load static remote page (remoteEntry.js) in host application. getStaticProps are not being called.
What we are trying to achieve is to create a next page with SSG and deploy the production build in any S3 bucket (no runtime/ serveless), refer remoteEntry.js in host application
If you any insights on this please help
The NextJS component level is necessary. how to write an SSR method. Is there another most recent bundle available?
How can I expose a component which needs to do an API call to full fill that component? And when I'm using that component in another repo it should be rendered on the server side.
And tell me is there any way to do a serverside call in the next js component level not in the page level?
I'm facing one issue with Module Federation For NextJs with Tailwind CSS. How to config tailwind css in the NextJS remote app and host app? Or How to get the tailwind CSS code for the remote app to host app and assets images?
I read it well, but the link between Next.js and Module Federation you're talking about has so much to lose compared to what you get.
You need to import the components of the remoteApp as a dynamic import (ssr false). The reason is that if you do static or dynamic import (ssr true), you will get a hydration error. You will use the entry.js of the remoteApp that was built at the time of the build on the server, but what if the remoteApp screen was modified in the meantime? You will see a 100% hydration error.
Dynamic import (ssr false) fails to render your components on the server, which eventually tarnishes one of Next.js' main objectives of optimizing SEO. It can also cause pages to appear slightly late, page layout to appear slightly broken, blinking, or shaking. Wouldn't it be better to split into monorepo and float servers in multiple locations and redirect different services??
Every time a remote app page is added, you have to keep adding and sync pages with shell, so what's the point of doing this hassle at the expense of the aforementioned?