Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions packages/mui-styles/src/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
/* eslint-disable import/export */
import { ponyfillGlobal } from '@mui/utils';

/* Warning if there are several instances of @mui/styles */
if (
process.env.NODE_ENV !== 'production' &&
process.env.NODE_ENV !== 'test' &&
typeof window !== 'undefined'
) {
ponyfillGlobal['__@mui/styles-init__'] = ponyfillGlobal['__@mui/styles-init__'] || 0;
globalThis['__@mui/styles-init__'] = globalThis['__@mui/styles-init__'] || 0;

if (ponyfillGlobal['__@mui/styles-init__'] === 1) {
if (globalThis['__@mui/styles-init__'] === 1) {
console.warn(
[
'It looks like there are several instances of `@mui/styles` initialized in this application.',
Expand All @@ -21,7 +20,7 @@ if (
);
}

ponyfillGlobal['__@mui/styles-init__'] += 1;
globalThis['__@mui/styles-init__'] += 1;
}

export { default as createGenerateClassName } from './createGenerateClassName';
Expand Down
5 changes: 4 additions & 1 deletion packages/mui-utils/src/ponyfillGlobal/ponyfillGlobal.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/* eslint-disable */
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
/**
* https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
* @deprecated Use `globalThis` instead.
*/
export default typeof window != 'undefined' && window.Math == Math
? window
: typeof self != 'undefined' && self.Math == Math
Expand Down