AnomalyInnovations / serverless-stack-demo-client

Source for the demo app client in the Serverless Stack Guide
https://demo2.serverless-stack.com
MIT License
635 stars 204 forks source link

improve aws-sdk import statement to reduce build size #20

Closed lepirlouit closed 6 years ago

lepirlouit commented 6 years ago

I suggest to replace the import statement in aws-lib import AWS from 'aws-sdk'; with import AWS from 'aws-sdk/global';

this will import aws config, etc without all the client services and apis.

This is enough to get the cognito credentials.

Size is reduced from 1.45mo to 145.69kb for aws-sdk.

source : https://github.com/aws/aws-sdk-js

jayair commented 6 years ago

@lepirlouit Hey yeah one of our other users found this and we added it to the tutorial - https://serverless-stack.com/chapters/deploy-to-s3.html#app-bundle-size

lepirlouit commented 6 years ago

Indeed. I didn't find this. Good Good.

jayair commented 6 years ago

@lepirlouit No worries. Thanks for pointing it out.