Current behavior:
babel-plugin-emotion doesn't add a class name label when using a re-exported version to the styled function.
To reproduce:
https://codesandbox.io/s/emotion-issue-template-r8v3h
styled from @emotion/styled and re-export it.styled in your app and use it to create a componentbabel-plugin-emotion does not include the variable name.Description | Screenshot
--- | ---
Using styled directly from @emotion/styled. Notice -Title is appended to the class name of the <h1>. | 
Using a re-exported version of styled. Notice -Title is missing from the class name of the <h1>. | 
Expected behavior:
babel-plugin-emotion should add the appropriate label to class names when using a re-exported version of the styled function. I'm currently using a re-exported version of styled in order to add the correct TypeScript types to the function, as instructed in the documentation.
Environment information:
react version: 16.12.0@emotion/core version: 10.0.22@emotion/styled version: 10.0.23babel-plugin-emotion version: 10.0.23This is a known issue and it has been fixed in v11 (available on npm under next tag). Unfortunately, it's too complicated to backport this to v10 - but hopefully we should be able to ship v11 in a month (I encourage you to try it out today though, it's stable and doesn't include many breaking changes).
Additionally - with v11 you shouldn't have to reexport styled just to add Theme type. Instead, you will be able to augment builtin interface
@Andarist Great, thanks! I would love to try v11 today but I can't find a summary of all the breaking changes. I can browse through all next releases but it's not very convenient.. Is there a recap somewhere?
I've extracted quickly the list from our changesets (which are available here - https://github.com/emotion-js/emotion/tree/1e4a741de6424d3d9c1f3ca9695e1953bed3a194/.changeset ):
innerRef propinstances option, any usage of it should be replaced with the importMap option (babel plugin)T parameter to the Matchers interface in the TypeScript definitions to make this module compatible with @types/jest@^24.0.20.@emotion/css - it's main purpose was to allow css to be a Babel macro, but since babel-plugin-macros allows us to keep imports nowadays this is no longer needed. @emotion/core/macro has been added to account for this use case and appropriate changes has been made to babel-plugin-emotion to facilitate those changes.@emotion/styled-base package. It has been moved to @emotion/styled and is available as @emotion/styled/base. This simplifies how the regular and base versions relate to each other and eliminates problems with stricter package managers when @emotion/styled-base was not installed explicitly by a user.emotion-theming has been removed and all its exports were moved to @emotion/core package. Please import them like this import { useTheme, ThemeProvider, withTheme } from '@emotion/core' from now on.Thanks!
@Andarist
About this
Instead of creating custom instances (like before) you can augment builtin Theme interface"
Do you have some examples?
I'm pretty sure I've seen a code snippet a while ago but can't find it again.
Closing this because, as mentioned, this will be resolved in v11 - but with it, there will also be fewer use cases for re-exporting styled. So, in general, it should become less of a pain to work with. Stay tuned.
Most helpful comment
Closing this because, as mentioned, this will be resolved in v11 - but with it, there will also be fewer use cases for re-exporting styled. So, in general, it should become less of a pain to work with. Stay tuned.