I use the require hook of BabelJS (formerly named 6to5) to run node apps with es6features:
// run.js
require(\"babel/register\");
require(\"./app.js6\");
I would prefer a call like
nodejs6 app.js6.
You may try the wrapper solution with babel-core api:
// Save as es6.js
var babel = require("babel-core");
var argc = process.argv.length;
babel.transformFile(process.argv[argc - 1], function (err, result) {
eval(result.code);
});
Run your es6 featured script with node es6 thefile.js
Reference: offical usage doc