module-federation-examples
module-federation-examples copied to clipboard
Add SSR example with React 18 Suspense
So i've created a working example for a server-side rendered application that hydrates on the client side.
- No loadable-components required
- No stats files being generated and consumed to load modules
- All using React 18's updates to the Suspense API that allows SSR.
- Removed enhancements such as CSS processing, HMR, etc. to make it very clear what is happening here.
In an issue that I posted, you made reference to loading the external remotes using HTTP. I wasn't able to get @telenko 's node-mf to work successfully, or @kenotron 's server-side-module-federation-plugin to work correctly.
I prefer the implementation for @kenotron 's library as it only involves lives on the server and doesn't require you to rebuild the remote with the plugin. However, I still couldn't get any of them to work.
I made some attempts to write my own remote module loader but started to run into trouble with the federated modules that were nested. I stopped because for my own purposes I don't really need this at this point and the original example did not include something like this.
Let me know your thoughts, if you think we should add anything else or remove something from this example.
Yeah nested remotes were tricky. From what I've seen, these after market plugins generally are quite limited. I'll pull my nextjs SSR plugin core out into a separate node plugin as I know my implementation is fully functional
Sounds good, let me know if you need any support with extracting the plugin core.
Will wait for that to be published to update my example.
Update. We have started to work on a node plugin. It already runs but need to smooth it out a little. Will likely pick up this branch and implement it with module-federation/node
Cool! Let me know if I can help in any way. Happy to support.
Update on this. Will try to release something this week.
Our node Federation tech is proprietary and contains patents.
Will see if I'm able to ship a limited feature set or ship it as bytecode. It won't be open source but I've wanted to offer our node implementation without licensing fees.
Do you happen to have a copy of the patent?
Do you happen to have a copy of the patent?
Serverless Software Federation - A System and Method for Streaming Heterogeneous Software to Ephemeral Compute 63288643 • Filed
Ah it's filed but not granted yet. I'll send you an email.
We filed and were granted provisional patents :) so we had the time to refine the design and other docs
ive open-sourced: https://github.com/module-federation/node
But the packae needs some work / cleanup - I'm mostly using a improved version of it under nextjs-mf/src/node-plugin
ive open-sourced: https://github.com/module-federation/node
But the packae needs some work / cleanup - I'm mostly using a improved version of it under nextjs-mf/src/node-plugin
Based on @botoxparty work, I gave the plugin a try, and it worked. But I have some doubts about the plugin configuration and an error on the client side. Everything is described in https://github.com/botoxparty/module-federation-examples/pull/1.
I would really appreciate it if you could take a look @ScriptedAlchemy. I want to understand it :slightly_smiling_face: Let me know if I can help.
@botoxparty is attempting to deploy a commit to the Module Federation Team on Vercel.
A member of the Team first needs to authorize it.
I have updated the PR to include @apehead 's work and have fixed the client side error that they were having.
It was basically just not loading any client-side javascript. I also added a button in the demo to test that javascript is being loaded in the client side correctly.
Let me know if there's anything else you'd like to see in this demo. I'm glad you've decided to open source these parts of module federation I think that will really help push adoption a lot further.
Agreed. Was a tough call but ultimately it's for the betterment of the community.
Others have been trying to replicate my tech for several months. Which has led to many depending on very unreliable plugins from various aspects.
Node-mf was one of the better ones out there, no shade to that repo. (But it's based on my early work back when webpack was in beta)
Thanks for updating and not dropping the PR. I'm very glad to have a solid example
If anyone runs into issues running this example it might be because you need [email protected], re: #2332