Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For Node 18 runtimes no longer exclude aws-sdk #354

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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 {
Expand Down