Linking to third party code
test.ts
Try running this:
Note that we did not have to provide the flag for this program, and yet it accessed the network. The runtime has special access to download imports and cache them to disk.
- On Windows:
%LOCALAPPDATA%/deno
( =FOLDERID_LocalAppData
) - On macOS:
$HOME/Library/Caches/deno
Specify the version in the URL. For example, this URL fully specifies the code
being run: https://unpkg.com/liltest@0.0.5/dist/liltest.js
.
deps.ts
And throughout the same project, you can import from the deps.ts
and avoid
having many references to the same URL:
This design circumvents a plethora of complexity spawned by package management software, centralized code repositories, and superfluous file formats.
This, like the above, is a problem faced by any remote dependency system.
Relying on external servers is convenient for development but brittle in
production. Production software should always vendor its dependencies. In Node
this is done by checking node_modules
into source control. In Deno this is
done by pointing to some project-local directory at runtime, and
similarly checking that into source control: