-
Notifications
You must be signed in to change notification settings - Fork 203
Add support for flow in babel #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
Conversation
Detects whether `flow-bin` is a dependency on the project, if so it will load the `@babel/preset-flow`-module
kentcdodds
left a comment
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! I'm in favor of this 👍 just one thing.
src/config/babelrc.js
Outdated
| ifAnyDep( | ||
| ['flow-bin'], | ||
| [ | ||
| require.resolve('@babel/preset-flow'), |
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.
We should add @babel/preset-flow to the dependencies so folks don't have to install it.
|
Interesting that the build is failing for not having |
|
Really strange that preset-flow is necessary, I didn't expect that. I will have a look into it |
|
The problem should be resolved now @kentcdodds |
kentcdodds
left a comment
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!
| {pragma: isPreact ? 'React.h' : undefined}, | ||
| ], | ||
| ), | ||
| ifAnyDep(['flow-bin'], [optionalRequire('@babel/preset-flow')]), |
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.
This should not be necessary. I think that we should actually include @babel/preset-flow in kcd-scripts' dependencies. (Part of the idea of this package is you generally shouldn't have to install tooling dependencies).
So we can get rid of optionalRequire.
|
Sorry, goofed up my git repo. Making a new repo |
Detects whether
flow-binis a dependency on the project, if so it will load the@babel/preset-flow-module.What:
In
babelrc.jswe should check ifflow-binis a dependency and then load the@babel/preset-flowWhy:
We have copied the same away
reactis being detected by usingifAnyDep-utilityHow:
Small change to
babelrc.jsChecklist: