跳转到主文档

tools.styledComponents

  • 类型: Object | Function
  • 默认值:见下方配置详情。
styledComponents 配置详情
{
pure: true,
displayName: true,
ssr: false,
transpileTemplateLiterals: true,
}
提示

更多关于:Styled Components 配置

对应 babel-plugin-styled-components 的配置。 值为 Object 类型时,利用 Object.assign 函数与默认配置合并。

modern.config.js
export default defineConfig({
tools: {
styledComponents: {}
}
});

值为 Function 类型时,默认配置作为参数传入,可以直接修改配置对象不返回任何东西,也可以返回一个值作为最终结果:

export default defineConfig({
tools: {
styledComponents: opts => {}
}
});