-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Babel feature detection #366
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
Grr... A dependency has a |
I like the idea, but I'm a bit wary of it. What if the native implementation has bugs and we want to use Babel for that? What is the runtime overhead of doing a bunch of feature detections? And https://github.com/hax/babel-features doesn't look very actively maintained nor used much https://www.npmjs.com/package/babel-features. I just don't want this to cause us a lot of extra overhead with support issues, etc. // @hax |
@sindresorhus: Check the 2.x (currently in beta) branch, it was last worked on 5 days ago 😉. It even already supports Babel 6. I think there's a little overhead, but not a whole lot. I'm not sure how we'd go about it any other way, regardless. And I guess we'd just assume that V8 isn't going to ship something horrifically broken. The overhead is going to down once we move babel to the main thread. |
We could create a preset for each Node.js major version →#148. Albeit that won't work when we eventually add browser support → #24.
They do all the time. That's the price for rapid evolution.
That's a good point. |
Sorry I have cold last week and not check the github notifications.
The runtime overhead of feature detection < 10ms, so I think it's ok for most applications.
Yes they have. But Babel also have 😀 . So we need to check it case by case. For example, whether to use |
There's also the case of many of the ES2015 features being a lot slower than the transpiled ones. |
@sindresorhus But I never see a real case such performance degradation is significant for a webapp (browser-side) in my daily work. Maybe heavy-load Node.js apps would affected by it. Anyway they can just switch from |
My vote is to punt on this until a later date. AVA and Babel both are currently moving at breakneck speed. I would prefer not to introduce an extra layer of complexity. |
This fixes #348. It uses
babel-preset-features
to auto-detect ES6 features. Also includes tests.Enjoy!