Skip to content

Commit

Permalink
fix: fix styled-component displayname
Browse files Browse the repository at this point in the history
  • Loading branch information
daydayhappychao committed Oct 10, 2023
1 parent 9bd959a commit 57bbbed
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/babel-preset-umi/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ export default (_context: any, opts: IOpts) => {
opts.pluginStyledComponents && [
require.resolve('babel-plugin-styled-components'),
{
// 该 plugin 会校验 styled 的来源
// 如果不是 `styled-components`, 需要手动引入后才能使 displayName 生效
topLevelImportPaths: ['@umijs/max'],
...opts.pluginStyledComponents,
},
],
Expand Down

0 comments on commit 57bbbed

Please sign in to comment.