logoDenoby example

Beginner

clideploy

Dependency Management

Edit

It is unwieldy to have to import the same remote module over and over again. Deno provides some conventions to make managing dependencies easier.

The Deno ecosystem has a convention to re-export all remote dependencies from a deps.ts file at the root of the repo. This keeps remote dependencies organized, and in a single place.
./deps.ts
export * as http from "https://deno.land/std@0.207.0/http/mod.ts";
export * as path from "https://deno.land/std@0.207.0/path/mod.ts";
Other files can then import dependencies from the deps.ts file.
./main.ts
import { path } from "./deps.ts";
Doing this makes package version upgrades really easy, as all external dependency specifiers live in the same file.

Run this example locally using the Deno CLI:

deno run https://examples.deno.land/dependency-management/main.ts

Additional resources: