styled-components / babel-plugin-styled-components

Improve the debugging experience and add server-side rendering support to styled-components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

redundant imports cause default-export version to not be transformed

gregorjan opened this issue · comments

When using named import from styled-components both babel and swc plugins are not used.

image

Funnily enough in codesandbox the behavior is exact opposite

Environment

System:

  • OS: Linux 5.15 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
  • CPU: (2) x64 AMD EPYC
  • Memory: 617.30 MB / 2.01 GB
  • Container: Yes
  • Shell: 5.8 - /bin/zsh

Binaries:

  • Node: 18.15.0 - /usr/local/bin/node
  • Yarn: 1.22.19 - /usr/local/bin/yarn
  • npm: 9.5.0 - /usr/local/bin/npm

npmPackages:

  • babel-plugin-styled-components: ^2.1.3 => 2.1.3
  • styled-components: ^6.0.0-rc.2 => 6.0.0-rc.2-4007

Reproduction

https://codesandbox.io/p/sandbox/jolly-haze-sf21k4

Steps to reproduce

Use babel-plugin-styled-components and named import from styled-components package

Expected Behavior

displayName is correctly added to class

Actual Behavior

displayName is not added to class

When using named import from styled-components both babel and swc plugins are not used.

Actually looking at your sandbox, it looks like only the button using the named import worked... I wonder if the plugin can handle one or the other but not both.