You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a goal of using Module Federation together with ModernJS. The repository I am creating is trying to leverage enhanced to attempt to demonstrate several capabilities.
We can do basic module federation of components using enhanced/runtime (this works)
We can do advanced module federation of routes that have server side rendered data (this does not)
When we import this remote into the header we are able to see the Async boundary as well as the delay in loading. Our initial understanding was that because this is wrapped in Await, the data fetch to the Pokemon api would be performed on the server (especially since this is being run with ssr streaming mode enabled.
After some further digging we made an attempt to expose another federated remote that has useLoaderData which does in fact do SSR and only renders the data when pulled up manually. However when we try to federate it into the header we get an error.
Unexpected Application Error!
useLoaderData must be used within a data router. See https://reactrouter.com/routers/picking-a-router.
Questions
What is the proper mechanism to do pure SSR functionality that does not expose the requests to the frontend if not useLoaderData?
If useLoaderData is the proper mechanism what are we missing?
It seems there are some documentation and example discrepancies around using the enhanced runtime and the modernjs configs.
Should we be using this methodology in the components themselves
Version
Details
We have a goal of using Module Federation together with ModernJS. The repository I am creating is trying to leverage enhanced to attempt to demonstrate several capabilities.
enhanced/runtime
(this works)Reproduce link
https://github.com/zackarychapple/modern-mf-example2
Reproduce Steps
When we import this remote into the header we are able to see the Async boundary as well as the delay in loading. Our initial understanding was that because this is wrapped in Await, the data fetch to the Pokemon api would be performed on the server (especially since this is being run with ssr streaming mode enabled.
After some further digging we made an attempt to expose another federated remote that has
useLoaderData
which does in fact do SSR and only renders the data when pulled up manually. However when we try to federate it into the header we get an error.The error
Questions
Should we be using this methodology in the components themselves
Or should we be using this in the
module-federation.config.ts
that is loaded via themoduleFederationPlugin
inmodern.config.ts
The text was updated successfully, but these errors were encountered: