Modules & Dependencies

Reloading Modules

By default, Deno uses a global cache directory (DENO_DIR) for downloaded dependencies. This cache is shared across all projects.

triangle-exclamation

You can force deno to refetch and recompile modules into the cache using the --reload flag.

# Reload everything
deno run --reload my_module.ts

# Reload a specific module
deno run --reload=jsr:@std/fs my_module.ts

Third party packages

Can be imported with jsr, npm and (https and http).

Directly in the .ts files

circle-info

Deno recommends JSRarrow-up-right, the modern JavaScript registry, for third party modules. There, you'll find plenty of well documented ES modules for your projects, including the Deno Standard Libraryarrow-up-right.

In deno.json

To better maintain code you can also map these imports in the "imports" section of deno.json.

With deno add

An even better way is to use the CLI to import these packages. It will automatically add them to the deno.json as "imports" and get the latest versions.

It is possible to be specific in what versions of packages you may want to import.

Deno can also load modules from private repositories like on Github.

Deno supports sending bearer tokens when requesting a remote module.

Check more info in the docs.

Deno provides a standard library written in TypeScript.

This standard library provide some packages for dealing with json, path, and many other.

The standard library is hosted on JSR and is available at: https://jsr.io/@stdarrow-up-right.

To install packages from the Deno Standard Library, you can use the deno add subcommand to add the package to your deno.json import map.

Last updated