babel-preset-eslatest-node6
v1.0.1
Published
Babel preset for the latest ECMAScript specification for Node v6
Downloads
272
Maintainers
Readme
babel-preset-eslatest-node6
Babel preset to make Node v6 fully compatible with the latest ECMAScript specification. This includes all finished proposals but not stage 0 to 3 proposals.
It intentionally won't compile things that are already natively supported by Node v6.
Included plugins
- ES2015
- modules (transform-es2015-modules-commonjs)
- ES2016
- exponentiation operator (transform-exponentiation-operator)
- ES2017
- trailing function commas (syntax-trailing-function-commas)
- async / await (transform-async-to-generator)
Missing features
For Object.values/Object.entries, String padding or Object.getOwnPropertyDescriptors support, use babel-polyfill or transform-runtime.
Install
npm install --save-dev babel-preset-eslatest-node6
Usage
Via .babelrc
(recommended)
.babelrc
{
"presets": ["eslatest-node6"]
}
Note: if you are using object rest/spread, you will need to add a few additional plugins to make it work:
npm install --save-dev \
babel-plugin-transform-es2015-destructuring \
babel-plugin-transform-es2015-parameters \
babel-plugin-transform-object-rest-spread
{
"presets": ["eslatest-node6"],
"plugins": [
"transform-es2015-destructuring",
"transform-es2015-parameters",
["transform-object-rest-spread", { "useBuiltIns": true }]
]
}
Via CLI
babel script.js --presets eslatest-node6
Via Node API
require('babel-core').transform('code', {
presets: ['eslatest-node6'],
})
Options
loose
- Enable "loose" transformations for any plugins in this preset that allow them (disabled by default).
{
"presets": [
["eslatest-node6", { "loose": true }]
]
}
Credits
Inspired by babel-preset-es2015-node6