Search code examples
typescriptnext.jsbabeljsstyled-components

Disable displayName option for styled components in next-config.js


is it possible to disable the displayName option for styled-components in the next-config.js? I know it's possible to disable by using a custom .babelrc, but i don't want to disable the next.js SWC, and if i create a custom .babelrc the SWC will be disabled.


Solution

  • Yes, it is possible.

      compiler: {
        styledComponents: {
          displayName: true,
          ssr: true,
        },

    Source: https://nextjs.org/docs/architecture/nextjs-compiler#supported-features