styled-components/babel-plugin-styled-components

Error in generating display names from recent upgrade

liemnotliam opened this issue · 5 comments

I'm getting an error when generating display names.

TypeError: ...codePath...: Cannot read property 'some' of undefined

The plugin config is bare, display name is enabled only in dev mode so our final builds are ok. For now, we've set displayName to false to avoid the error.

[
    'babel-plugin-styled-components',
    { ssr: false, displayName: api.env('development') },
]

The error started when we upgraded the package to v1.13.0. Prior to that, it was working fine.

It might be this change that's causing an error? It introduced code affecting display names and has a few places where some is being called.

@liemnotliam it might have something to do with what I fixed in #340, the plugin was wrongfully assigning withConfig statements to helpers in certain scenarios. Could you try 1.13.2-test.1 and let me know if it works for you?

If it's still breaking, some example of the affected code would be awesome so I can put it in a regression test.

It's still showing the same error with 1.13.2-test.1. The affected code includes our internal components library so I can't share that. I'll need to dig around for how those are configured for a reproducible code sample but it may be tricky as there are a few moving parts.

It's still showing the same error with 1.13.2-test.1. The affected code includes our internal components library so I can't share that. I'll need to dig around for how those are configured for a reproducible code sample but it may be tricky as there are a few moving parts.

One possible way to find a reproduction is to comment out ones with more exotic syntaxes until the error goes away and then post a code sample of the one(s) that are currently problematic.

Should be handled in 1.13.2, I added some guard clauses

it works now, thank you!