As mentioned by @cpojer this can significantly speed up the tests. We only need to leave the CommonJS transform from ES6 because Node doesn't support modules yet.
https://twitter.com/cpojer/status/783651892320571394
If you intend to work on this please write in a comment here. If somebody else is already working on it please don't try to beat them. If you later change your mind it's fine but please comment here so somebody else can take the issue.
Update: @shubheksha will work on this.
There's a danger, mentioned in the twitter thread, right? Wouldn't this break ES6 style import/exports? I mean I realize it's kind of fake, but if you're trying to keep from writing multiple types of import styles it actually helps to have this on.
This might be interesting to look at https://github.com/babel/babel-preset-env
It would still require the ES module transform.
Wow I am blind. It says that right there...
@cpojer what about async await. if you are a disabling it you would need to document it properly because node 6 does not support async await
async/await is not part of ES2015.
@cpojer was a dummy there was using typescript async await that's why I forgot that async await transform is not applied there
We're working on https://github.com/babel/babel-preset-env right now (and would appreciate help here). This would figure out the correct plugins to run given the environment (browsers/node/etc)
With https://github.com/babel/babel-preset-env/pull/12/files were trying to use https://github.com/kangax/compat-table to get the data. In reading the data I'm finding some missing data for node that people can help fill in https://github.com/kangax/compat-table/pull/932. I can write up a guide on how to do so as well.
There are also other presets that people have already made (basically turn off plugins and use process.version to detect)
https://github.com/michaelcontento/babel-preset-modern-node/blob/master/index.js
https://github.com/rtsao/babel-preset-es2015-node/blob/master/index.js
and probably others by searching npm
@hzoo I just merged a PR that uses -env. I assume it's relatively stable/works, even if incomplete?
It should be ok - data is at https://github.com/babel/babel-preset-env/blob/master/data/plugins.json and users can add the debug option to console.log the plugins used.
It's probably more safe than other presets because it checks for 100% implementation before compiling - better to not compile if it implements more than Babel's implementation (another feature).
Would be a discussion in babel-preset-env's issue but what do we do about partial support (90% usecase, strict mode, etc) https://github.com/babel/babel-preset-env/issues/16
Should it just use native if the basics or the feature are implemented? https://github.com/rtsao/babel-preset-es2015-node/blob/master/index.js is very lenient
We're going to always pick the safest option possible as it's just an optimization.
馃憤 Might be overkill but it would be interesting to get data on what fails to see what features in compat-table users are transpiling (most likely the non 100% versions would still work).
we should totally do this in babel as well 馃槃
Most helpful comment
We're working on https://github.com/babel/babel-preset-env right now (and would appreciate help here). This would figure out the correct plugins to run given the environment (browsers/node/etc)
With https://github.com/babel/babel-preset-env/pull/12/files were trying to use https://github.com/kangax/compat-table to get the data. In reading the data I'm finding some missing data for node that people can help fill in https://github.com/kangax/compat-table/pull/932. I can write up a guide on how to do so as well.
There are also other presets that people have already made (basically turn off plugins and use process.version to detect)
https://github.com/michaelcontento/babel-preset-modern-node/blob/master/index.js
https://github.com/rtsao/babel-preset-es2015-node/blob/master/index.js
and probably others by searching npm