Skip to content

Commit

Permalink
[styled-engine] Create cache only if document is available (#36001)
Browse files Browse the repository at this point in the history
  • Loading branch information
m4theushw committed Feb 6, 2023
1 parent 435680d commit 684cd85
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import createCache from '@emotion/cache';

// prepend: true moves MUI styles to the top of the <head> so they're loaded first.
// It allows developers to easily override MUI styles with other styling solutions, like CSS modules.
const cache = createCache({ key: 'css', prepend: true });
let cache;
if (typeof document === 'object') {
cache = createCache({ key: 'css', prepend: true });
}

export default function StyledEngineProvider(props) {
const { injectFirst, children } = props;
Expand Down

0 comments on commit 684cd85

Please sign in to comment.