-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Deno installs unused npm dependencies despite --entrypoint flag usage #27627
Comments
The behavior you want was implemented in #27300, gated behind an unstable flag. It's technically a breaking change (it can break things in some edge cases), so we didn't enable it by default. (That PR description is out of date, I ended up changing it so You can opt in with the
in deno.json |
@nathanwhit It did worked, but if i have this: {
"tasks": {
"dev": "deno run --watch main.ts"
},
"lock": {
"frozen": true
},
"unstable": ["npm-lazy-caching"],
"imports": {
"@std/assert": "jsr:@std/assert@1",
"dbmate": "npm:[email protected]",
"express": "npm:[email protected]"
}
} Runnin |
Actually after some tests it only works if you provide the flags on the command it self, setting it in the deno.json under the unstable property did not work. |
Another update, with this deno.json and the same main.ts as above: {
"tasks": {
"dev": "deno run --watch --cached-only main.ts"
},
"lock": {
"frozen": false
},
"unstable": ["npm-lazy-caching"],
"imports": {
"@std/assert": "jsr:@std/assert@1",
"dbmate": "npm:[email protected]",
"express": "npm:[email protected]"
}
} Running: deno clean && deno install --entrypoint main.ts && du -h --max-depth=0 ~/.cache/deno I get:
Which means the unstable prop did not work. Running: deno clean && deno install --entrypoint --unstable-npm-lazy-caching main.ts && du -h --max-depth=0 ~/.cache/deno I get:
If i followup this with the following command: deno task dev I get:
Looks like deno task command just downloads everything? If instead of running deno task i run the command directly:
I get an error and also a warning about the unstable config:
But if i add
output:
Running From this examples looks like the deno.json |
Given this simple project:
main.ts:
deno.json:
Running:
I get the following output:
If now i edit the
main.ts
to comment out theimport "express"
line, and rerun the above command:i get:
Checking into the files, it appears that both
dbmate
andexpress
are being installed even tho i do not usedbmate
directly, and since i am running the install command with--entrypoint
i would expect deno to only installexpress
.Is my assumption correct? i would expect deno to be smart about which deps are being used and only install does.
The text was updated successfully, but these errors were encountered: