To run Node.js app with ES6 features enabled, we set the presets option.
For instance, in package.json, we write
{
"dependencies": {
"babel-cli": "^6.0.0",
"babel-preset-es2015": "^6.0.0"
},
"scripts": {
"start": "babel-node --presets es2015 app.js"
}
}
to add the babel-preset-es2015
package.
And we set the --presets
option when we run babel-node
to enable the ES6 features.