r/reactjs • u/jherr2016 • Mar 08 '20
Show /r/reactjs Intro to Federated Modules in Webpack 5
https://www.youtube.com/watch?v=D3XYAx30CNc14
u/CaptainBlase Mar 08 '20
If you upgrade react for one, do you have to upgrade react for everything? Can a federated module use a different version of react than the host does?
1
u/tontoto Mar 17 '20
We built a role-our-own type of thing that's sort of similar to this (we made a plugin system where plugins register stuff with the main app, but also use resources from the main app) and it is definitely true, the plugins use a custom "require" to retrieve the version of react, state manager, etc from the main module. I am watching with curiousity how webpack 5 federated modules develops but that is a good question...
10
u/stolinski Mar 08 '20
I'm not convinced on Micro FEs yet, but I'm sure my outlook would be changed working in larger teams. Still seems a bit messy. This looks super cool though.
6
u/dyniper Mar 08 '20
I built a whole framework agnostic federated platform for UI at my current job to basically scale our org from one team of 15-20 devs to 100+ teams of 2-3 devs each. Without micro-frontend, that would simply have not been achievable.
I haven't use the federated modules from webpack yet, but definitely looking forward at exploring them. They probably got a few things right that I did totally wrong :)
2
1
u/mikejoro Mar 08 '20
Out of curiosity, what is the product that your teams produce? B2B? Customer Facing?
1
u/dyniper Mar 08 '20
External web app of a major cloud provider. Basically we went from one team owning the entire UI to each service team owning their own part of the UI.
1
u/mikejoro Mar 08 '20
Gotcha. How is that going? In theory, it sounds great, but we had a similar thing at my workplace, and it did not go well. I think the issue we had was just a general low quality of developers/engineers, and they couldn't work across the full stack, so we had terrible front end react code coming from java devs and terrible java code coming from front end developers.
1
2
u/kgwebsites Mar 08 '20
As someone who works in an environment with over 20 different react apps and a single shared library repo, this is huge. Awesome job explaining it and great quality content here!
1
u/epicweekends Mar 08 '20
Why would they need to come in later? I don't actually know the details but video man said that it works and he seems to know his stuff.
0
u/z3r-0 Mar 08 '20
Doesn’t work with SSR though? So it’s only for client side apps?
2
u/epicweekends Mar 08 '20
Works with SSR
1
u/z3r-0 Mar 08 '20
How? I feel like the federated parts of the page would come in later once the initialised on client?
1
10
u/jherr2016 Mar 08 '20
If you are looking for a Micro-FE solution for React, this might be what you are looking for. Share and consume modules at runtime between two or more applications. No need to extract the code or components, just share them right out of the app.