Skip to content
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

SSR support with Module Federation (Different instances of vendor module) #797

Open
botoxparty opened this issue Jun 8, 2022 · 1 comment

Comments

@botoxparty
Copy link

botoxparty commented Jun 8, 2022

Hi.

I currently am working on an application that uses the following setup:

  • React DOM Server with renderToPipeableStream for streaming SSR
  • Module federation to load modules at runtime

The issue i've run into is that the remote modules that use styled-jsx do not detect the provided StyleRegistry because the vendor code is bundled into the remote. Module Federation supports sharing dependencies however this does not seem to be working at all with styled-jsx.

I have tested this and can confirm that the vendor code for "styled-jsx" is never shared amongst packages.

Is there any way to make styled-jsx play nicely with module federation's dependency sharing?

I'm not sure how things work under the hood and how webpack bundles the transpiled code from styled-jsx but somehow I need all my remotes to use the same StyleRegistryContext so that I can render the style tags on the server side.

Any ideas?

Best,
Adam

@huozhi
Copy link
Member

huozhi commented Jun 8, 2022

Hi, do you have a code sample that built up with styled-jsx and module fedoration that we could play and investigate with? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants