From 6a2ee207d2b74a7083cf8ffb3b049ce139866972 Mon Sep 17 00:00:00 2001 From: Christian Nuss Date: Fri, 24 Nov 2023 13:23:44 -0500 Subject: [PATCH] always have a default force exclude --- index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 25006c7c..ae0ea28c 100644 --- a/index.js +++ b/index.js @@ -47,11 +47,16 @@ function applyUserConfig(config, userConfig, servicePath, runtime) { const runtimeVersion = Number.parseInt((runtime || "").replace("nodejs", ""), 10) || 12; + // Exclude aws-sdk from default if runtime >= 18 + const forceExclude = config.options.forceExclude.filter( + (item) => !(runtimeVersion >= 18 && item === "aws-sdk") + ); + // Concat forceExclude if provided if (userConfig.forceExclude) { - userConfig.forceExclude = config.options.forceExclude - .filter((item) => !(runtimeVersion >= 18 && item === "aws-sdk")) - .concat(userConfig.forceExclude); + userConfig.forceExclude = forceExclude.concat(userConfig.forceExclude); + } else { + userConfig.forceExclude = forceExclude; } // Concat externals if a list of packages are provided