New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix css props when using babel macro with babel-plugin-styled-components 1.10.1 #2633
Conversation
@jamesknelson can you add a test please? |
I can't get the tests running on my machine, so can't do so at the moment. I get this when trying to run
Looks like the tests are not compiling modules to commonjs for some reason. Any ideas? |
@jamesknelson hmm weird, a |
I'm not sure what's going on - I've run On the other hand, there is a macro test already, and it passes on CI. |
I’ll add one to your branch
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for figuring this out! What a weird set of behaviors...
Released as 4.3.2, thanks so much for tackling this! |
Currently, if you follow the guide to using styled-components with Create React App,
css
props will not work. This is due to a change introduced in babel-plugin-styled-components 1.10.1.This fix resolves the issue by switching the macro to use
@babel/traverse(path)
instead ofpath.traverse()
. For some reason, this makes theProgram
visitor work, whereas it doesn't withpath.traverse()
.See styled-components/babel-plugin-styled-components#226 for details