Closed K1tson closed 2 years ago
Do you really want to share a theme? When you updated the theme you will need to update all your micro frontends.
I use MUI with module federations and I prefer to have micro frontends with their own ThemeProvider
s.
Share as @mui/
with the trailing slash on the end of the key
I currently have multiple React v17 apps which utilise Module Federation from Webpack 5. I would like for my MUI 5 theme to be shared across all of these micro frontends without having a there own
ThemeProvider
wrapped around each exposed component. At present, APP 1 (Shell) adds a custom theme into the MUIThemeProvider
and all Micro UI's are lazy loaded as children. The custom theme works for the container components but not for the micro frontend components. I am following a micro frontend architecture with the following configuration:...and so forth for all other micro frontends.
APP 1 - Module federation config:
APP 2 - Module federation config:
Module federation shared dependencies config for both APP1 & APP2
APP 1 (Shell) - Snip of theme provider code:
I would expect that because all the MUI modules are being shared as a singleton, all theme data setup in the initial shell would be accessible in the child micro frontend components.
Just to confirm as well that RTK & RTK Query work perfectly when shared so I suspect I'm missing something when adding a module to be shared for MUI 5 maybe?
If you need anything further then please don't hesitate to ask.
Thank you in advance.