Skip to content

Commit

Permalink
[core] Fix warning leak in production
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Dec 1, 2022
1 parent 3751f20 commit 836ced8
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions packages/mui-material/src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,19 @@ export { default as useIsFocusVisible } from './useIsFocusVisible';
// eslint-disable-next-line @typescript-eslint/naming-convention
export const unstable_ClassNameGenerator = {
configure: (generator) => {
console.warn(
[
'MUI: `ClassNameGenerator` import from `@mui/material/utils` is outdated and might cause unexpected issues.',
'',
"You should use `import { unstable_ClassNameGenerator } from '@mui/material/className'` instead",
'',
'The detail of the issue: https://github.com/mui/material-ui/issues/30011#issuecomment-1024993401',
'',
'The updated documentation: https://mui.com/guides/classname-generator/',
].join('\n'),
);
if (process.env.NODE_ENV !== 'production') {
console.warn(
[
'MUI: `ClassNameGenerator` import from `@mui/material/utils` is outdated and might cause unexpected issues.',
'',
"You should use `import { unstable_ClassNameGenerator } from '@mui/material/className'` instead",
'',
'The detail of the issue: https://github.com/mui/material-ui/issues/30011#issuecomment-1024993401',
'',
'The updated documentation: https://mui.com/guides/classname-generator/',
].join('\n'),
);
}
ClassNameGenerator.configure(generator);
},
};

0 comments on commit 836ced8

Please sign in to comment.