After transitioning my React SSR from pure @emotion to material-ui 5.0, I encountered an issue where the styles no longer get extracted. The ID extraction in createExtractCriticalToChunks
seems to be functioning correctly, but the cache.inserted object from emotion is always empty. Can anyone point out what I might be doing wrong here?
"@emotion/babel-plugin": "^11.3.0",
"@emotion/cache": "^11.6.0",
"@emotion/core": "11.0.0",
"@emotion/css": "^11.5.0",
"@emotion/react": "^11.6.0",
"@emotion/server": "^11.4.0",
"@emotion/styled": "^11.6.0",
"@mui/icons-material": "5.0.0",
"@mui/lab": "5.0.0-alpha.47",
"@mui/material": "5.0.0",
"@mui/styles": "5.0.0",
"@mui/utils": "5.0.0",
"@mui/x-data-grid": "5.0.0-beta.1",
HTML:
<style data-emotion="css-global 1vs7qi2"> (styles continue...)
Extracted ID's:
{
global: true,
khurd4: true,
'1ure1x2': true,
(ID's continue...)
}
Cache:
{
key: 'css',
sheet: e {
(cache details...)
},
nonce: undefined,
inserted: {},
registered: {},
insert: [Function: o],
compat: true
}
Cache Setup SSR:
(SSR setup code snippet...)
ServerApp.js
(<ServerApp component structure...)
MUI SSR: Link to MUI Server Rendering Guide