Beginner
clideploy
Dependency Management
EditIt 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 "jsr:@std/http";
export * as path from "jsr:@std/path";
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://raw.githubusercontent.com/denoland/deno-docs/main/by-example/dependency-management.ts/main
Additional resources: