New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ClassNameGenerator] Prevent all base
imports
#31297
[ClassNameGenerator] Prevent all base
imports
#31297
Conversation
@material-ui/core: parsed: +0.10% , gzip: +0.16% |
6772fa5
to
3579db6
Compare
Yes, it is unstable API so we can play around. My proposal would be to show a meaningful message containing the new import people should make. |
@mnajdova decided to do the same with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a breaking change sectio in the PR description, so that we don't forget to include it in the changelog of the release.
Fix #30011 (comment)
BREAKING CHANGE
unstable_ClassNameGenerator
has been moved fromutils
toclassName
folder to prevent all MUI Base module imports. Please update the import in your project if you use this module:Note: the usage does not change.
Root cause
To fix this, the import must be specific and must not include any base components. So I move
unstable_ClassNameGenerator
to its own folder:In the future, if we want to do anything related to className we can put them in this folder. If we continue to use
utils
folder, there might be a regression in the future if we forgot about this.Note
Not sure why CodeSandbox does not work but it works locally (by pulling from CodeSandbox built)
Further questions
Should it throw an error for the current import from
@mui/material/utils
so it leads people to import from@mui/material/className
instead?I have followed (at least) the PR section of the contributing guide.