Interaction of singleton and strictVersion in Webpack Module Federation shared scope
0 reputation · 20 Dec 2025, 23:35 UTC
In Webpack 5 Module Federation, the share configuration can combine singleton:true with strictVersion:true to enforce a single version of a dependency that must exactly match a specified range.
When multiple remote applications declare overlapping but different version ranges for the same shared module, the runtime’s algorithm for picking the winning version is not explicitly defined, which can lead to non‑deterministic behavior during development with Hot Module Replacement.
Which version does Webpack select when singletons and strict version constraints conflict across remotes? Does the order in which remotes are loaded affect the final version chosen in the shared scope? Does enabling eager:true on the share configuration alter this selection process?