Modules & Dependencies
Reloading Modules
By default, Deno uses a global cache directory (DENO_DIR) for downloaded dependencies. This cache is shared across all projects.
Have this in mind when starting projects:
If project only have
deno.jsonfile,node_modulesfolder will NOT be created and dependencies will be downloaded to this global cache.It may be possible to force
deno.jsonto createnode_modulescheck more at docs.
If project have
deno.jsonandpackage.jsonfiles,node_modulesis created and dependencies are downloaded to it.
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.tsThird party packages
Can be imported with jsr, npm and (https and http).
Directly in the .ts files
.ts filesIn deno.json
deno.jsonTo better maintain code you can also map these imports in the "imports" section of deno.json.
With deno add
deno addAn 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/@std.
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