I'm in the process of breaking down my monolithic frontend code into multiple micro frontends using React. All of these micro frontends utilize the MUI Library for their UI components. However, I've also developed some custom UI components that are shared among these micro frontends. I'm seeking advice on the best approach to share these components efficiently.
Considering that these shared components also depend on MUI, I want to ensure that the MUI library is loaded only once when the host micro frontend is loaded. Should I create a new micro frontend specifically for these shared components, or would it be better to package them into an npm package and use it as a dependency? Alternatively, are there any other solutions recommended for this scenario?
It's important to note that these shared components also rely on MUI, so optimizing the loading of MUI is a key consideration for me.
Any insights into the best practices for handling this situation would be greatly appreciated!
Note: I am using Webpack 5 and Module Federation