styled-components/babel-plugin-styled-components

minifier removes space between & and ::after

agriffis opened this issue · 2 comments

There's a bug reported against SWC because it works differently from this plugin, but AFAICT the bug is in the plugin, not SWC.

Report: vercel/next.js#30802 (comment)
My response: vercel/next.js#30802 (comment)

Basically when the minifier encounters .globalClass & ::after it kills the space between the ampersand and the colons.

I have the same problem with & :not(:last-child). Also tested with some other selectors.

Context: In my case (https://github.com/vrk-kpa/suomifi-ui-components/blob/v7.0.0-beta.1/src/core/Form/FilterInput/FilterInput.baseStyles.tsx#L39) I'm trying to add separator between items. But after minification the selector matches to the parent element instead of the items.

Fixed by #376 and released in v2.0.7