We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9f6a6d0 commit 1008ebcCopy full SHA for 1008ebc
lib/build.js
@@ -4,14 +4,22 @@ var conf = require("./config");
4
var webpack = require("webpack");
5
var merge = require("webpack-merge");
6
7
+// custom babel target for each node version
8
+function getBabelTarget(){
9
+ var runtimes = ["nodejs8.10", "nodejs4.3.2", "nodejs6.10.3"];
10
+ var current = process.env["AWS_LAMBDA_JS_RUNTIME"] || "nodejs6.10.3";
11
+ var unknown = runtimes.indexOf(current) === -1;
12
+ return unknown ? "6.10" : current.replace(/^nodejs/);
13
+}
14
+
15
function webpackConfig(dir, additionalConfig) {
16
var config = conf.load();
17
var babelOpts = {cacheDirectory: true};
18
if (!fs.existsSync(path.join(process.cwd(), '.babelrc'))) {
19
babelOpts.presets = [
20
["env", {
21
targets: {
- node: "6.10"
22
+ node: getBabelTarget()
23
}
24
}]
25
];
0 commit comments