Deno compile inflates output size in monorepo — includes unused dependencies from other packages
I'm using a monorepo setup with multiple Deno projects as members (e.g., frontend/, backend/, shared/). When I compile a single project (e.g., backend/) using deno compile, the output binary size is significantly larger compared to when the project was standalone.
Specifically:
In a standalone setup, the compiled binary is ~70 MB.
In the monorepo, the binary inflates to over 180 MB.
It appears that deno compile is including node_modules (used by frontend/ or other projects) even though the project being compiled only has one small dependency.
Is there a way to solve this?
1 Reply
Bundle the code first using Deno bundle, then compile it without including node_modules dir.
Make sure you bundled with packages included.