Drop the layers, bundle up with ESBuild instead
Learn how you can structure your serverless projects to share code between Lambda Functions using ESBuild instead of Lambda Layers.
I’ve seen a lot of posts around the problems that Lambda Layers bring. A very good one is called You shouldn’t use Lambda Layers by AJ Stuyvenberg. In this post AJ explains the myths and cons of using Lambda Layers. What is not easy to find is examples on how to actually get rid of Lambda Layers by using a bundler. In this post we will go through a structure and configuration that allows us to remove Layers by using ESBuild to bundle the dependencies and shared code for our…