Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Material-UI v5 not working styled-components and typescript?

I'm trying to use the mui-v5 with styled-components and typescript. However, even after I added the line to my tsconfig:

"paths": {
  "@mui/styled-engine": [ "./node_modules/@mui/styled-engine-sc" ]
}

I'm getting an error:

Could not find dependency: '@emotion/styled' relative to '/node_modules/@mui/styled-engine/index.js'

when doing: import { ThemeProvider } from "@mui/material/styles";

I made a Code Sandbox to show my setup.

Does anyone know what I'm doing wrong?

like image 220
MarksCode Avatar asked Feb 16 '26 16:02

MarksCode


1 Answers

You need to add @emotion/styled and @emotion/react to dependencies

like image 177
thug_ Avatar answered Feb 19 '26 07:02

thug_



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!