Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

ImportMeta

Deno provides extra properties on import.meta. These are included here to ensure that these are still available when using the Deno namespace in conjunction with other type libs, like dom.

interface ImportMeta {
main: boolean;
url: string;
resolve(specifier: string): string;
}

§Properties

§
main: boolean
[src]

A flag that indicates if the current module is the main module that was called when starting the program under Deno.

if (import.meta.main) {
  // this was loaded as the main module, maybe do some bootstrapping
}
§
url: string
[src]

A string representation of the fully qualified module URL.

§Methods

§
resolve(specifier: string): string
[src]

A function that returns resolved specifier as if it would be imported using import(specifier).

console.log(import.meta.resolve("./foo.js"));
// file:///dev/foo.js