-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In module federation with React and SSR, remote modules are not working properly #19677
Comments
Also if you choose default (CSS )when generating remotes, CSS modules in remotes are failing in SSR when you try to use them inside remote component. |
Unfortunately, it's not working with 17.0.2 either. Migrated my workspace and then, to be sure, recreated host and remotes. Still same behaviour, wrong (the first in list) federated module gets rendered.
|
hey @thanhiro, in the all your tsconfig.server.json, under all the remotes and host, do you have these types
this should fix your css error? |
Yes, those types are defined. But when I even try to import a CSS module in federated SSR, there's this error:
|
@thanhiro i tried latest nx with ssr example out of the box, it seems fine. do you have a repo for this error? |
Yet again I recreated everything, with 17.0.3, and like documentation suggests. And the behaviour is exactly the same.
My repo here: https://github.com/thanhiro/nx-example/ |
@thanhiro i checkout your repo. when i ran also, i saw you changed the background of product page, which runs fine: |
Are you sure they are properly server-side rendered? CSR is working for me, and if JavaScript is enabled, pages are replaced by proper version by client-side React. But SSRing is failing. 🤷🏻 |
i see. i am able to replicate it now. i think this issue is related to webpack-contrib/mini-css-extract-plugin#90. the nx webpack config uses plugin mini-css-extract-plugin under the hood. |
Hi, please note that CSS bug is actually not the original topic why I filed this issue, just something I noted as an additional problem when generating SSR + MF applications as instructed. Upgraded to 17.1.2 and the original problem still persist and wrong module gets rendered in server, so problem lies in how federated modules are resolved server side. |
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
When using React-specific instructions from https://nx.dev/recipes/react/module-federation-with-ssr and running
store
host, remotecheckout
is not rendered in SSR. Instead, first remote,product
is shown in it's place, before it gets replaced by CSRedcheckout
.Expected Behavior
Remote
checkout
should be rendered in SSR.GitHub Repo
No response
Steps to Reproduce
nx g @nx/angular:host store --ssr --remotes=product,checkout
nx serve store
Nx Report
Failure Logs
No response
Package Manager Version
No response
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: