Skip to content

Allow option to exclude aws-sdk from final bundles #8864

@arackaf

Description

@arackaf

Describe the problem

AWS Lambda currently (automatically) ships a version of the "aws-sdk" package (NOT the various "@aws-sdk/dynamo|lambda|etc|etc" packages).

You still have the option to bundle, and ship your own version of the sdk, if you need a very specific version, but otherwise you can exclude it, and save a TON of bundle size in your lambda.

It would be great if SvelteKit were to expose an exclude or external option for that purpose (which, presumably, esbuild would just hook into).

The difference can be substantial. I just removed a single usage of aws-sdk for the DynamoClient, and replaced it with @aws-sdk/client-dynamodb and @aws-sdk/lib-dynamodb and the deployed function size dropped by 1.86MB (yes, really).

Describe the proposed solution

The Vercel adapter already has an external config property, but it's only for edge functions. Could we open it up for Lambda deploys, too? aws-sdk is the only use case I can think of for it, but there might be others—plus, aws might in the future start shipping the v3 @aws-sdk/xyz packages, so this would be useful for that, too.

Alternatives considered

Not that I can think of.

Importance

would make my life easier

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions