Babel preset including es2015, es2016, es2017.
npm install --save-dev babel-preset-latest
.babelrc
{
"presets": ["latest"]
}
babel script.js --presets latest
require("babel-core").transform("code", {
presets: ["latest"]
});
es2015
: Optionally not run any plugins from this preset (defaults to true)es2016
: Optionally not run any plugins from this preset (defaults to true)es2017
: Optionally not run any plugins from this preset (defaults to true)
{
"presets": [
["latest", {
"es2015": false // defaults to true
}]
]
}
You can also pass options down to the es2015
preset.
{
"presets": [
["latest", {
"es2015": {
"modules": false
}
}]
]
}