Vendoring Dependencies

deno vendor <specifiers>... will download all remote dependencies of the specified modules into a local vendor folder. For example:

  1. # Vendor the remote dependencies of main.ts
  2. $ deno vendor main.ts
  3. # Example file system tree
  4. $ tree
  5. .
  6. ├── main.ts
  7. └── vendor
  8. ├── deno.land
  9. ├── import_map.json
  10. └── raw.githubusercontent.com
  11. # Check the directory into source control
  12. $ git add -u vendor
  13. $ git commit

To then use the vendored dependencies in your program, just add import-map=vendor/import_map.json to your Deno invocations. You can also add --no-remote to your invocation to completely disable fetching of remote modules to ensure it’s using the modules in the vendor directory.

  1. deno run --no-remote --import-map=vendor/import_map.json main.ts

Note that you may specify multiple modules and remote modules when vendoring.

  1. deno vendor main.ts test.deps.ts https://deno.land/std/path/mod.ts

Run deno vendor --help for more details.