2

When upgrading the Next version from 12 to 13 I got the error "Warning: Prop className did not match." pointing to styled-components. My initial setup was with babel, including babel-plugin-styled-components, but when I stumbled across this thread I decided to try out SWC. My understanding was that it should solve my error, by following these steps. I have:
- Removed the file .babelrc to let SWC be the default compiler
- Added to the next.config.js file

  compiler: {
    styledComponents: true
  }

I also tried removing the babel-plugin-styled-components dependency and installed swc-loader, but I don't think that made any difference. How can I make sure that SWC is running (I guess it is), and how can I resolve the error (preferably by using SWC instead of Babel)?

  • Any luck? Having the same issue. Had to disable SWC and use .babelrc with "styled-components", { "ssr": true, "displayName": true, "preprocess": false }. Would prefer using the default SWC instead of what seem to be a hackish solution – Dan P. May 02 '23 at 21:42

0 Answers0