ES6 usage requires --harmony
flag in node v0.12.3.
Is there a way to do so for an aws lambda function?
You can use babel to transform es6/es7 to be compatible with node 0.10.x:
http://www.rricard.me/es6/aws/lambda/nodejs/2015/11/29/es6-on-aws-lambda.html
EDIT:
There is also a really cool AWS lambda deployer called Apex with that you can transform and deploy es6/es7 code easily! Examples: https://github.com/apex/apex/tree/master/_examples/babel-webpack
EDIT2: There is an other AWS lambda deployer called Gordon which also helps you integrate lambda with other services such as:
They also have a lot of useful examples
AWS Lambda use v0.10.36
, but anyway I think we can try in this way
var spawn = require("child_process").spawn;
var child = spawn('node', [ "--harmony", "es6.js" ], {
cwd: __dirname
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With