From 48465e3006c51e1cd1d8a5163c04ed325818d118 Mon Sep 17 00:00:00 2001 From: warrickhill Date: Fri, 10 Mar 2023 08:42:07 +0000 Subject: [PATCH] For Node 18 runtimes no longer exclude aws-sdk --- index.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index cbe5466a..beabc530 100644 --- a/index.js +++ b/index.js @@ -43,6 +43,15 @@ function applyWebpackOptions(custom, config) { function applyUserConfig(config, userConfig, servicePath, runtime) { config.servicePath = servicePath; + // Default to Node 12 if no runtime found + config.nodeVersion = + Number.parseInt((runtime || "").replace("nodejs", ""), 10) || 12; + + // AWS Node 18 no longer supports aws-sdk v2 so now must be included in output + if (config.nodeVersion >= 18) { + config.options.forceExclude = []; + } + // Concat forceExclude if provided if (userConfig.forceExclude) { userConfig.forceExclude = config.options.forceExclude.concat( @@ -65,10 +74,6 @@ function applyUserConfig(config, userConfig, servicePath, runtime) { } Object.assign(config.options, userConfig); - - // Default to Node 12 if no runtime found - config.nodeVersion = - Number.parseInt((runtime || "").replace("nodejs", ""), 10) || 12; } class ServerlessPlugin extends ServerlessWebpack {