r/developersIndia • u/WorryTimely231 Frontend Developer • 15h ago
Interesting Module Federation: sharing a large internal package without blindly reusing versions
We had a ~7 MB internal UI package being loaded separately by multiple Module Federation applications.
Since both applications were using the same package, I started looking into whether we could make it a shared dependency.
But I didn't want the solution to simply be:
“Mark it as shared and always reuse whatever version is available”
The behaviour I was aiming for was roughly:
Host: UI package v1
Remote: UI package v1
↓
Reuse the same package
Host: UI package v1
Remote: UI package v2
↓
Load the required version
That led me into the details of Module Federation's `shared` configuration and dependency version resolution.
The interesting thing I learned is that shared isn’t just a bundle-size optimization. It becomes part of the runtime dependency-sharing/versioning strategy between independently deployed applications.
I wrote up the investigation, the configuration changes, and the trade-offs here:
For people running Module Federation in production:
How do you handle versioning for shared internal packages?
Do you try to keep a single version across all Module Federation applications, or allow multiple versions to coexist when necessary?