Multiple versions of dependencies #829
-
Is there currently a way to have each micro front end own it's own dependencies? My teams import different versions of component libraries. I'd like each team to be able to load its own dependencies (not rely on the global import map). frontEnd1 might have componentLibrary v1.0.1 and frontEnd2 might have componentLibrary v1.0.2. I'm aware the best practice would be to standardize and use same version, just a bit unrealistic at the scale I need. Any help is appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Yes; just make sure that those deps are not in the webpack/rollup externals array. |
Beta Was this translation helpful? Give feedback.
-
Another approach (besides not making deps webpack externals) is to keep them as externals but use import map scopes to change which version is used for which microfrontend. This is more complex to manage, but allows you to share multiple versions of dependencies - for example maybe two microfrontends use React 16 and two use React 17, but you only want one instance of React 16 and one of React 17. https://github.com/WICG/import-maps#scoping-examples This approach is not inherently better than @frehner's approach above, but I shared just in case it's useful for those reading through this. |
Beta Was this translation helpful? Give feedback.
Yes; just make sure that those deps are not in the webpack/rollup externals array.