Skip to content

Commit

Permalink
remove aws-sdk from default config
Browse files Browse the repository at this point in the history
  • Loading branch information
cnuss committed Nov 24, 2023
1 parent 6a2ee20 commit b1fc98c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +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")
);
// Force exclude aws-sdk for versions below Node 18
if (runtimeVersion < 18) {
config.options.forceExclude.push("aws-sdk");
}

// Concat forceExclude if provided
if (userConfig.forceExclude) {
userConfig.forceExclude = forceExclude.concat(userConfig.forceExclude);
} else {
userConfig.forceExclude = forceExclude;
userConfig.forceExclude = config.options.forceExclude.concat(
userConfig.forceExclude
);
}

// Concat externals if a list of packages are provided
Expand Down
3 changes: 1 addition & 2 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ module.exports = {
packagerOptions: {},
generateStatsFiles: false,
tsConfig: "tsconfig.json",
// Exclude aws-sdk since it's available in the Lambda runtime (< nodejs18.x)
forceExclude: ["aws-sdk"],
forceExclude: [],
disableForkTsChecker: false,
// Set non Webpack compatible packages as externals
// Or if we want to exclude all packages in the node_modules:
Expand Down

0 comments on commit b1fc98c

Please sign in to comment.