twilio / twilio-node

Node.js helper library
MIT License
1.4k stars 511 forks source link

Make module tree shakable #638

Closed thomaschaaf closed 3 years ago

thomaschaaf commented 3 years ago

Issue Summary

The way this package is built webpack is not able to shake off unused code. This causes this npm module to be very large at 13 MB. To speed up (cold starts) of AWS Lambda functions the code needs to be as small as possible this library currently is extremly huge.

Technical details:

eshanholtz commented 3 years ago

Would the packages lazy loading functionality help with speeding up lambda functions?

thomaschaaf commented 3 years ago

No as webpack still can not remove the files which are unused.

mattensor commented 3 years ago

I'm having the same issue, twilio is bloating my lambda. @thomaschaaf Did you have any luck reducing your bundle? I'm considering throwing this packing and using http calls to hit the communications api

thomaschaaf commented 3 years ago

@mattensor i am using serverless-webpack and put it in the externals that way at least it's only included once.