📄

Reducing Deployment Package Size with the Serverless Framework

This article was automatically translated from theJapanese original by AI. It may contain translation errors.

This post was published over 2 years ago. Its content may be outdated.

I had defined several Lambdas with the Serverless Framework and deployed them, and the package size had grown to around 1.3GB, so I’ll reduce it.

Code

package:
   excludeDevDependencies: false
   patterns:
     - "!.git/**"
     - "!node_modules/**"
     - "!aws/**"
     - "!__pycache__/**"
     - "!.venv/**"

Since it was a Python * Lambda setup, __pycache__/ and .venv/ were included. Add entries to patterns to match your environment. A leading ! on a string means “exclude.” With this, 1.3G -> 24mb 🥳

References

Recent Articles

Network(beta)

Drag to move / Ctrl+wheel to zoom