Size of the aws-xray-sdk-core package dependencies (i.e. the bundle)
ignaciolarranaga opened this issue · comments
Hi guys, I'm trying to reduce the size of my bundle in a lambda and discovered that the dependencies added by the aws-xray-sdk-core sum a lot, being specific, a project just with this dependency:
{
"name": "sample",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"aws-xray-sdk-core": "^3.5.0"
}
}
Has 5.9M in the node_modules:
724K @aws-sdk
3.8M @types
252K async-hook-jl
32K atomic-batcher
396K aws-xray-sdk-core
144K cls-hooked
28K emitter-listener
24K lru-cache
256K semver
44K shimmer
108K stack-chain
112K tslib
32K yallist
Is there a way to prune some of this context?, e.g. @aws-sdk (which is already packaged in the lambda context), @types, semver?
Can I prune it manually for example to just include aws-xray-sdk-core?
Thanks in advance.
For @aws-sdk it could be removed since AWS Lambda NodeJs Runtime has it. But the others we are not sure, since AWS Lambda does not provide a full list of dependencies by default(and it might be changed without notice?), we cannot guarantee whether XRay SDK work in Lambda after pruning something. So, please prune the dependencies based on your experience if required.