-
-
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
Disable ES2015 transforms based on node version using babel-preset-env #878
Conversation
presets: [ | ||
[require('babel-preset-env').default, { | ||
"targets": { | ||
"node": parseInt(process.versions.node), |
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.
- Let's change this to
parseFloat
as we discussed to fix features introduced in minor Node releases. - This line misses an indentation.
module.exports = { | ||
presets: [ | ||
[require('babel-preset-env').default, { | ||
"targets": { |
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.
Nitpick: quotes are unnecessary here, let's leave just targets
and node
.
if (env === 'test') { | ||
module.exports = { | ||
presets: [ | ||
[require('babel-preset-env').default, { |
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.
Let's add a comment above this line.
Something like
// ES features necessary for user's Node version
} | ||
else { |
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.
Nit: please move else
to the previous line, i.e.
} else {
Looks great, thank you! |
We could totally do |
@hzoo Note I think it should be |
Oops yeah totally, I just copied the wrong thing from the diff 😛 |
@hzoo - yes, gladly, thank you! |
facebook#878) * Disable ES2015 transforms based on node version using babel-preset-env * pass major version number for node to babel-preset-env instead of version string * use parseFloat() instead of parseInt() to parse node version * fixed style nits
facebook#878) * Disable ES2015 transforms based on node version using babel-preset-env * pass major version number for node to babel-preset-env instead of version string * use parseFloat() instead of parseInt() to parse node version * fixed style nits
Fixes #863