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

aws-sdk import brings the entire sdk #39

Open
fusionbeam opened this issue Jan 8, 2024 · 2 comments
Open

aws-sdk import brings the entire sdk #39

fusionbeam opened this issue Jan 8, 2024 · 2 comments

Comments

@fusionbeam
Copy link

Hi,

Thank you for your work.
We are using this library in context where size matters and we noticed this module brings along the entire aws-sdk.
Is there a way to import the S3 client only?

See attached web pack report.

Thank you,
Ra
Screenshot 2024-01-08 at 10 25 52

@ThaNarie
Copy link
Member

ThaNarie commented Jan 8, 2024

Hi @fusionbeam,

This library was mostly meant to be used in tooling (as cli, or from node), so it hasn't been designed in this way.
Looking at the v2 AWS SDK, it might not even be possible.

Reading over the v3 release notes, it seems they restructured their complete package to allow more granular imports, and thus bundling: https://github.com/aws/aws-sdk-js-v3?tab=readme-ov-file#modularized-packages.

So for this request we would need to migrate this library to use the v3 SDK.

Additional, I see some other modules are used that are more meant to work in a node environment (like globbing, path resolving), so potentially some extra work would need to be done to make those dependencies optional as well.

Have you verified that this module is actually working (besides the side constraints) in your context? (or is Node still your context, but you like to limit file bundle size?)

@fusionbeam
Copy link
Author

Thanks for your quick response.
We're using it in a node environment, on some slow connections on machines with a one liner download & execute script. This reduces maintenance/versioning work across multiple machines.

Having said that, since 2.6.0 It is possible to import only portions of the sdk.

See here: aws/aws-sdk-js#1120

var S3 = require('aws-sdk/clients/s3');
You can also still access the AWS namespace that includes only services you've imported:

var AWS = require('aws-sdk/global');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants