Reducing artifact size proportionally correlates with the cold start latency.

The most obvious way would be to use webpack and do tree shaking. But I’m not a fan of that approach. It’s cumbersome to set up and has significant dev effort, especially when you face issues with bundling some backend dependencies.

I’ll talk about some “quick wins” instead.

We’ll use a tool called  fdu to inspect junk in node_modules.

#serverless #lambda #refactoring

3x Smaller Lambda Artifacts by Removing Junk From node_modules
1.25 GEEK