material-ui
material-ui copied to clipboard
Source maps not working with nextjs@13
Duplicates
- [X] I have searched the existing issues
Latest version
- [X] I have tested the latest version
Steps to reproduce 🕹
Link to live example:
Steps:
- Clone https://github.com/Siegrift/material-ui/tree/broken-source-maps-repro
-
cd examples/nextjs-with-typescript
-
npm i
-
npm run dev
- Open
http://localhost:3000/
and open devtools - Inspect the elements and the see that the CSS source maps are broken
Current behavior 😯
Devtools point to the bundled CSS and not to the source file where it's defined.


Expected behavior 🤔
I'd expect devtools to point me to the actual file and the CSS definition like it does in https://emotion.sh/docs/source-maps
Context 🔦
I've migrated from material-ui@4 to v5 and while understanding the migration from JSS I noticed that source maps were not working. I've tried to look for this issue, but haven't found a solution... Two of the most promising things were:
- Use the babel emotion plugin for nextjs. This didn't work, because the next/font needs SWC compiler and the SWC compiler doesn't work when
.babelrc
is defined. - Use emotion plugin for the SWC compiler, but this didn't help either.
Your environment 🌎
npx @mui/envinfo
Need to install the following packages:
@mui/[email protected]
Ok to proceed? (y) y
System:
OS: macOS 13.0.1
Binaries:
Node: 18.12.1 - ~/.volta/tools/image/node/18.12.1/bin/node
Yarn: 1.22.19 - ~/.volta/tools/image/yarn/1.22.19/bin/yarn
npm: 8.12.2 - ~/.volta/tools/image/npm/8.12.2/bin/npm
Browsers:
Chrome: 108.0.5359.98
Edge: Not Found
Firefox: Not Found
Safari: 16.1
npmPackages:
@emotion/react: latest => 11.10.5
@emotion/styled: latest => 11.10.5
@mui/base: 5.0.0-alpha.109
@mui/core-downloads-tracker: 5.10.17
@mui/icons-material: latest => 5.10.16
@mui/material: latest => 5.10.17
@mui/private-theming: 5.10.16
@mui/styled-engine: 5.10.16
@mui/system: 5.10.17
@mui/types: 7.2.2
@mui/utils: 5.10.16
@types/react: latest => 18.0.26
react: latest => 18.2.0
react-dom: latest => 18.2.0
typescript: latest => 4.9.4
next.js version: 13.0.6