-
Notifications
You must be signed in to change notification settings - Fork 75
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
babel-preset-crank #66
Comments
@ryhinchey |
@ryhinchey Does this plugin automatically insert an
|
Yah - that’s exactly what it does |
Technically this plugin does 2 things.
I think importing the createElement function by hand is annoying. I appreciate being explicit but find this instance of it unnecessary given most developers won’t actually use createElement in their code directly. That said, this plugin could provide both options. EDIT: there is an issue if someone imports createElement because they actually use it in their code. It probably is best to require the import now that I’m thinking about it more. |
Ok I just released |
If there was logic which checked if it didn’t exist and imported it I wouldn’t mind that either! |
Yah maybe I’ll do that. Seems like too much logic for a super simple Babel plugin |
Technically, it still does two things - it also adds '@babel/plugin-transform-react-jsx' to the list of Babel plugins. I realized that when I tried to remove it and go back to using the pragma comments - without them, the import of createElement is flagged as an unused import. |
@jonrsawyer you mean eslint is flagging That’s to be expected and we need to have a crank eslint preset to turn that off or do it manually in your eslint config. |
I just updated this preset to also add |
I made a babel preset for crank so you don't have to type these two lines in every component you write:
It works with webpack right now but for Parcel you'll need to upgrade to Parcel 2. There's an existing bug with JSX pragmas that won't get fixed until the next major version of parcel.
I'll close this issue in a day or two :)
The text was updated successfully, but these errors were encountered: