babel-plugin-styled-components: 1.13.2 generates cannot read property 'property' of undefined

I’m using Next.js and when trying 1.13.2 I get the following webpack-error for a component:

TypeError: Form.tsx: Cannot read property 'property' of undefined

The only css in the component are three declarations looking like this:

const StyledFormComponent = styled.div display: flex;;

With 1.13.1 there are no errors.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 4
  • Comments: 19

Most upvoted comments

FYI: Rollup v3 output.generatedCode.reservedNamesAsProps setting on true is not compatible with this plugin due to this bug. Thus for now whenever you generate code containing styled-components from rollup, set output.generatedCode.reservedNamesAsProps to false in rollup.

Adding on @andi1984 I also had added output.interop: "auto" to act the same as tsconfig.json@compilerOptions.esModuleInterop: true

Mh, understandable.

We will have to go for forking then! Thanks for keeping the project open-source so this is even possible šŸ‘šŸ¼

Oh, btw found a workaround: setting "pure": false skips the code path that blows up