-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Document Babel macros support and common uses #3858
Comments
cc @kentcdodds do you have a list somewhere/ |
partial application with https://github.com/citycide/param.macro |
emotion https://github.com/emotion-js/emotion/tree/master/packages/babel-plugin-emotion#babel-macros (needs a better doc page ofc) |
I should note that some plugins have still not upgraded from |
Also, I'll be giving a talk at a meetup in two weeks about using babel-plugin-macros with create-react-app. I'll make sure that's recorded and add a link to the docs 👍 |
I just added a |
A sterling example of a painful case of css plugin: |
not sure if this is create-react-app related or webpack related as @kentcdodds pointed out, but the errors when something doesn't compile in babel-macros are very unhelpful. kentcdodds/babel-plugin-macros#79 |
I believe it has nothing to do with babel macros specifically and is more generally babel... |
right, sorry for not clarifying that @kentcdodds |
Not sure if this is the right place to ask this, but is babel-plugin-macros supposed to be working with 2.0.0-next.a671462c? I've tried to use it but haven't been able to get more than the rather opaque 'Failed to compile.' when I try to use a macro. |
styled-components v4 also has a Babel macro! 🎉 https://www.styled-components.com/docs/tooling#babel-macro |
#5481 |
I was looking at how to print a warning message regarding
versus
The problem is that users are going to be instructed to This is important so the DEV / QA person can tell whether a given element in the Browser Developer Tools is a TabularWhoosieWhatsitContainer or if it's a TabularWhoosieWhatsitFlexRow. Currently when they look at it they see something like When the users are not instructed to update to 'styled-components/macro', this issue is happening because the babel plugin for styled-components will never be loaded because it will never be included in the babel config that gets generated here
I checked whats trivially possible to do in the styled-components repo by putting
I found that when I When I So there is no great way to warn users about this at build time from within the It may be possible to warn the user from inside create-react-app, but its easier said than done. It's not as easy as checking what packages they have installed because The tool that issues the warning would potentially have to be a macro/linter itself, that would go through your code looking for The alternative would be to issue the warning in the browser. But that seems like it might be risky, ugly, bad practice etc. I suppose the other-OTHER alternative would be to modify The above does work ( |
using https://styled-components.com/docs/tooling#babel-macro will failed all my snapshot unit test, errors complains: Where XXX can be span, li, etc |
Need to keep track:
The text was updated successfully, but these errors were encountered: