When using preset-env as designed it will not add the Promise#finally polyfill. Promise#finally did not ship until NodeJS v10+ so it should be doing it all the way up to that.
package.json snippet
"@babel/cli": "^7.0.0-beta.52",
"@babel/core": "^7.0.0-beta.52",
"@babel/node": "^7.0.0-beta.52",
"@babel/plugin-proposal-class-properties": "^7.0.0-beta.52",
"@babel/polyfill": "^7.0.0-beta.52",
"@babel/preset-env": "^7.0.0-beta.52",
"@babel/preset-flow": "^7.0.0-beta.52",
"@babel/register": "^7.0.0-beta.52",
.babelrc
{
presets: [
"@babel/preset-flow",
[
"@babel/preset-env",
{
debug: true,
useBuiltIns: "usage",
shippedProposals: true,
targets: {
node: "8.10"
}
}
]
],
plugins: ["@babel/plugin-proposal-class-properties"]
}
Debug Output:
Using plugins:
proposal-async-generator-functions { "node":"8.10" }
syntax-object-rest-spread { "node":"8.10" }
proposal-unicode-property-regex { "node":"8.10" }
proposal-optional-catch-binding { "node":"8.10" }
Using polyfills with `usage` option:
[/Users/Shared/Development/projects/aws-lambda-runner/lib/plugin.js] Based on your code and targets, none were added.
[/Users/Shared/Development/projects/aws-lambda-runner/lib/runner.js] Based on your code and targets, none were added.
Transpiles To:
if (typeof runner === 'function') {
return runFunctionInstance(runner, config, event, context, callback).then(({
result: _result,
data: _data
} = {}) => {
// code
}).catch(err => {
// code
}).finally(async () => {
// code
}
When Run by Node 8.10 as specified:
2018-07-10T01:41:09.326Z 5181d267-83e2-11e8-8df6-5bb8f152a769 TypeError: runFunctionInstance(...).then(...).catch(...).finally is not a function
at runAWSLambdaRunnerStartupEvaluation (/var/task/node_modules/aws-lambda-runner/dist/runner.js:162:17)```
When using preset-env as designed it will not add the
Promise#finallypolyfill. Promise#finally did not ship until NodeJS v10+ so it should be doing it all the way up to that.package.json snippet
.babelrc
Debug Output:
Transpiles To:
When Run by Node 8.10 as specified: