Skip to content

Deleted dependencies from earlier version of the code still downloaded  #21261

@marvinhagemeister

Description

@marvinhagemeister

Just noticed that deno run downloads a lot of modules referencing an earlier iteration of the code when deno.json is present. When I delete the deno.json file it works as expected.

Steps to reproduce

  1. Create deno.json with { "lock": true } as the content
  2. Create `foo.ts with this content:
import "npm:htm";
import "npm:preact";
import "npm:preact-render-to-string";
console.log("foo");
  1. Run deno run -A foo.ts (a deno.lock should be present now)
  2. Delete all imports in foo.ts
  3. Run deno run -Ar foo.ts -> Downloads all npm modules from the previous iteration

Tip: On macOS/Linux use deno run -Ar foo.ts &> foo.log to pipe the output to foo.log which highlights the problem more clearly.

It seems like it's not possible to remove an npm dependency once it was imported at some point in the project. Looking at the deno.lock file it seems to confirm that theory as it still contains all three npm imports.

Metadata

Metadata

Labels

needs discussionthis topic needs further discussion to determine what action to takenode compattriage required 👀Deno team needs to make a decision if this change is desired

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions