In Serverless v2 with Node 14/16 and aws-sdk v2 I was including the package in devDependencies in package.json. In production aws-sdk was not including in final compiled bundle (perfect because is including in the runtime).
Note: I use the command serverless package
In Serverless v3 with Node 18 and aws-sdk v3, the packages in devDependencies are included in production bundle (I saw them in sourcemap) ! Which multiplied by 5 the size of my lambdas.
Anyone knows “the trick” please? I tried with optional and peer dependencies, nothing change.