-
-
Notifications
You must be signed in to change notification settings - Fork 26.7k
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
Switch to preset-env #1742
Switch to preset-env #1742
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,10 +84,13 @@ if (env === 'test') { | |
module.exports = { | ||
presets: [ | ||
// Latest stable ECMAScript features | ||
[require.resolve('babel-preset-latest'), { | ||
'es2015': { | ||
modules: false | ||
} | ||
[require.resolve('babel-preset-env'), { | ||
targets: { | ||
// We support everything React supports | ||
'ie': 9 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style nit: maybe just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm pretty sure ie 9 covers all that uglify doesn't support, but we can add it for redundancy. Uglify was only added for people targeting e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand but it's good to leave on for people who get excited and immediately override this after ejecting. 😉 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh wait it's in a preset. I guess it doesn't matter that much then. |
||
}, | ||
// Disable polyfill transforms | ||
useBuiltIns: false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this do? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is disabled by default but I explicitly set it false so it doesn't accidentally get enabled in a minor release. Setting this to true requires npm 3 (or node 6) and transforms import "core-js/modules/es7.string.pad-start";
import "core-js/modules/es7.string.pad-end";
import "core-js/modules/web.timers";
import "core-js/modules/web.immediate";
import "core-js/modules/web.dom.iterable";
... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enabling it will transform There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @existentialism correct me if I'm wrong but we can't enable this until we drop npm 2.x or node 4 support, correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it should work... we aren't going to drop node < 4 until 2.x lands. |
||
}], | ||
// JSX, Flow | ||
require.resolve('babel-preset-react') | ||
|
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.
Are you sure this is enough to match
latest
behavior? How did you verify?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.
I actually checked the plugins by hand, and there is a subtle difference.
Latest includes
transform-es2015-duplicate-keys
, Env does not.Env includes
babel-plugin-check-es2015-constants
, latest does not.This does result in slightly different code:
In:
env:
latest:
I'm not sure which is proper behavior, but I assume there was a reason for this.
/cc @hzoo @existentialism
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.
Looks like we missed it in our plugin mapping, will fix!