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