Skip to content

URL Imports

URL Imports are a way to import a file from a url. This is useful for importing dependencies from a CDN or from a remote server.

// Importing a file from a url
import {
} from "";

function totalCost(outbound: number, inbound: number, tax: number): number {
  return multiply(add(outbound, inbound), tax);

console.log(totalCost(19, 31, 1.2));
console.log(totalCost(45, 27, 1.15));

 * Output
 * 60
 * 82.8

You can import typescript or jsx files right from via URL Imports. This allows you to directly use or to import dependencies. As long as Reejs has the necessary Deno polyfills for any Deno specific APIs used in the imported file, it will work.

Incase you were wondering about Deno permissions, Reejs will automatically grant all permissions to any file imported via URL Imports.

// Importing a file from a url
import * as denoGraph from "";

const graph = await denoGraph.createGraph("");
console.log(graph); //just works :)

Shouldn't it be tiresome to type out the whole url everytime?

Well... Maybe? That's why we support import maps. Also you could use deps.{js/ts} file from where you can declare all your depedencies and import from there, as Deno suggests. You can read more about deps.{js/ts} here.

Released under the MIT License.