Babel preset to make node@7 ES2017 compatible.
Node@7 has great ES2017 support, the most excited change is the support of async function in harmony flag, this module just adds missing features:
- modules (transform-es2015-modules-commonjs)
- transform export extensions (transform-export-extensions)
- class properties (transform-class-properties)
- object rest spread (syntax-object-rest-spread)
- trailing function commas (syntax-trailing-function-commas)
$ npm install --save-dev babel-preset-es2017-node7
Read "Configuring Babel 6" article for more information about babel@6 configuration.
# 7.6.0 > Node.js version > 7.0.0
node --harmony script.js
# Node.js version >= 7.6.0
node script.js
.babelrc
{
"presets": ["es2017-node7"]
}
If you are using webpack 2, this will help for import
/ export
was natively supported in Webpack 2.
{
"presets": ["es2017-node7/webpack2"]
}
babel script.js --presets es2017-node7
require('babel-core').transform('code', {
presets: ['es2017-node7'],
})
- Inspired by babel-preset-es2015-node6