mattzcarey / code-review-gpt

Code review powered by LLMs (OpenAI GPT4, Sonnet 3.5) & Embeddings ⚡️ Improve code quality and catch bugs before you break production 🚀 Lives in your Github/GitLab/Azure DevOps CI
https://oriontools.ai
MIT License
1.6k stars 162 forks source link

[Bug] [2h Timebox] Lambdas are including aws-cdk-lib in the bundle #260

Closed mattzcarey closed 4 months ago

mattzcarey commented 1 year ago

Description: Lambdas are pretty huge. They are obviously including lots of stuff which we shouldnt package in them. aws-cdk-lib is the obvious one. It is normally down to module resolution in commonjs.

Expected Outcomes: Know what the issue is and the most pragmatic way to fix it.

April-Bates-Dev commented 1 year ago

Actual outcomes:

These are the current sizes of our staging lambdas: staging-get-user-lambda 9.8 MB staging-update-user-lambda 9.9 MB staging-demo-review-lambda 10.4 MB staging-review-lambda 1.2 MB

This is big but not enormous. Options were explored for resolving this issue.

We are building the code in services/core using tsc. After an andon with Ryan, he suggested that if we built the code with esbuild, we can use this site to analyse which packages are making it into our production build. esbuild should also create a better build than tsc.

The follow up suggestion is therefore to use esbuild rather than tsc as our bundler, for both bundle size and observability.

Follow up ticket: https://github.com/users/mattzcarey/projects/1/views/1?pane=issue&itemId=38625966