Skip to content

deno compile --no-check produces a smaller binary then deno compile #28254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sigmaSd opened this issue Feb 23, 2025 · 1 comment
Open

deno compile --no-check produces a smaller binary then deno compile #28254

sigmaSd opened this issue Feb 23, 2025 · 1 comment
Labels
compile related to the `deno compile` feature

Comments

@sigmaSd
Copy link
Contributor

sigmaSd commented Feb 23, 2025

Version: Deno 2.2

This is because deno compile a.ts downoads and embeds @types/node and undici-types/

I think downloading them is ok for checking but embedding them is wrong

Reproduce

  • mkdir a && cd a
  • echo 'import "npm:ansi-regex";' > a.ts
  • compare:
    • DENO_DIR=$PWD/deno_dir deno compile --no-check a.ts
    • DENO_DIR=$PWD/deno_dir deno compile a.ts
@dsherret dsherret added the compile related to the `deno compile` feature label Feb 23, 2025
@M4RC3L05
Copy link
Contributor

Maybe we need something like --unstable-npm-lazy-caching for compile? that would look into the file being compiled and only include npm packages that are atually being used?.

In my case, i have esbuild and react in the imports of deno.json and deno compile includes them in the compiled binary, but are not included if they are not in the imports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compile related to the `deno compile` feature
Projects
None yet
Development

No branches or pull requests

3 participants