AnomalyInnovations / serverless-bundle

Optimized packages for ES6 and TypeScript Node.js Lambda functions without any configuration.
https://serverless-stack.com/chapters/package-lambdas-with-serverless-bundle.html
MIT License
532 stars 153 forks source link

Conditional `forceExclude` of `aws-sdk` based on `runtime` version #366

Closed cnuss closed 7 months ago

cnuss commented 7 months ago

On nodejs18.x and greater, aws-sdk is no longer included and should be conditionally excluded based on the runtime version, instead of being a hardcoded exclude.

Fixes:

Ref: https://stackoverflow.com/a/74792625

cnuss commented 7 months ago

cc @jayair could i get some 👀 on this please? thank you!

cc @warrickhill this is a similar fix to https://github.com/AnomalyInnovations/serverless-bundle/pull/354 but includes tests 😄, which I didn't actually see your pre-existing PR until after I did this work.

cnuss commented 7 months ago

Ok I tweaked this a bit so that the "default config" doesn't hardcode aws-sdk. It's now programatically added in the event the runtime is less than nodejs18.x, which should be more future proof!

augustl commented 7 months ago

We currently use our own fork of serverless-bundle because of this. Good work, hope this gets merged!

jayair commented 7 months ago

Thank you for this (and adding the tests)!