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

library is 857MB #1630

Closed
davidmaxwaterman opened this issue Jul 16, 2017 · 5 comments
Closed

library is 857MB #1630

davidmaxwaterman opened this issue Jul 16, 2017 · 5 comments
Labels
guidance Question that needs advice or information.

Comments

@davidmaxwaterman
Copy link

This library is pretty big. For PWAs it would be desirable to store it in the sw cache and space is limited. I imagine the app could download it only when it's online, but that is quite 'awkward'.

Is there any prospect of reducing its size, or perhaps making it modular?

@jeskew
Copy link
Contributor

jeskew commented Jul 16, 2017

There are a few ways to minimize the size of the SDK used in an application. If you're using a tool like webpack or browserify, you can require a service client directly (see the README for an example), which will only transitively require the model files for one service and thus allow webpack to exclude any unused model files from the built application bundle.

You can also use the SDK's Browser Builder, which will build a custom version of the SDK including only the services you select. By default, the browser builder includes all services that support CORS. I just ran the browser builder to get a default build and a build with all services, and the minified and gzipped files are 198K and 249K, respectively:

$ ls -lh
-rwxrwxrwx 1 root root 1.6M Jul 16 10:42 aws-sdk-2.85.0-all.min.js
-rwxrwxrwx 1 root root 249K Jul 16 10:45 aws-sdk-2.85.0-all.min.js.gz
-rwxrwxrwx 1 root root 1.2M Jul 16 09:48 aws-sdk-2.85.0.min.js
-rwxrwxrwx 1 root root 198K Jul 16 10:45 aws-sdk-2.85.0.min.js.gz

Out of curiosity, where did you get an 857MB build of the SDK? Even downloading an archive of the full repository (tests, docs, and all) from the releases tab on GitHub is only 5.5MB.

@davidmaxwaterman
Copy link
Author

Thanks for the suggestions.

I used bower install.

@jeskew
Copy link
Contributor

jeskew commented Jul 16, 2017

Inside of the artifact bower pulls down is a dist folder, which contains minified and unminified copies of the browser version of the SDK. They are comparable in size to what you would download from the browser builder.

@davidmaxwaterman
Copy link
Author

Actually, I think I'm wrong about the size :

bower_components/aws-sdk/dist$ du -sh aws-sdk.js
857M    aws-sdk.js
bower_components/aws-sdk/dist$ wc -c aws-sdk.js
1749732 aws-sdk.js

What do you make of that?!

ls -l confirms the wc -c output.

It seems du is playing with my mind. I am inclined to blame WSL....indeed, there are a few issues, including:

microsoft/WSL#1894

So, I guess 'nothing to see here' :) Sorry for the noise.

@srchase srchase added guidance Question that needs advice or information. and removed Question labels Jan 4, 2019
@lock
Copy link

lock bot commented Sep 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

3 participants