Class name generation issue when building a component which is dependent on MUI and when used inside a project which uses MUI #40726
Labels
package: system
Specific to @mui/system
status: waiting for author
Issue with insufficient information
v4.x
Steps to reproduce
Steps:
Current behavior
Say we have an app which uses MUI and we install a package from npm where the same version of MUI is a peer dependency, the class names collides (same names generated). To avoid this when we use StylesProvider with createGenerateClassName inside the package, immediate children to the StylesProvider is where the config setup for createGenerateClassName is taking effect and rest of the elements is using the class generation defined at the app level.
Expected behavior
We were expecting was that once a StylesProvider with createGenerateClassName is mentioned at a component level, that takes precedence for everything inside that component over what is mentioned at the app level.
Context
We are trying to build and publish a few scoped packages which are distributed across our org via npm teams which gets used in multiple projects (all of those uses the same version of MUI). How should we structure the code when we are building a scoped package published in npm so that the styles of the component and the app in which it gets used doesn't collide.
Your environment
Search keywords: createGenerateClassName
The text was updated successfully, but these errors were encountered: