在 next-config.js 中禁用样式组件的 displayName 选项

问题描述 投票:0回答:1

是否可以在

displayName
中禁用样式组件的
next-config.js
选项?我知道可以通过使用自定义
.babelrc
来禁用,但我不想禁用 next.js SWC,如果我创建自定义
.babelrc
,SWC 将被禁用。

typescript next.js babeljs styled-components
1个回答
0
投票

是的,这是可能的。

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

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

© www.soinside.com 2019 - 2024. All rights reserved.