denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
98.01k stars 5.39k forks source link

deno install --prod #26121

Open Spioune opened 1 month ago

Spioune commented 1 month ago

I have a npm monorepo:

sveltekit-front only has devDependencies because it is built as a static website deno-server only has "normal" dependencies, no devDependencies. sveltekit-front has the shared package in devDependencies deno-server has the shared package in dependencies

I use docker to deploy both apps.

To create the deno-server docker image: I copy the root package.json, lockfile, apps/deno-server and packages/shared then I run deno install inside the root directory (I cannot just run deno install inside apps/deno-server because I am in a monorepo, I need the packages/shared symlink)

The problem is that deno install installs all dependencies, even devDependencies that are not needed for production.

Maybe I am missing something. Thanks

michael-ball-ctct commented 2 weeks ago

Essentially the same root issue as https://github.com/denoland/deno/issues/22736 - but both raise a great point. I found both while trying to find out how to achieve this, which I expected to already exist.

It seems like a great feature for reducing the both the size and security footprint of deno prod installs and compiled binaries, and a somewhat expected one for backwards compatibility with Node libraries/codebases.