Deno standard library
Go to Latest
class default
import { default } from "";


default(id?, parent?: Module | null)


children: Module[]
exports: any
filename: string | null
id: string
loaded: boolean
parent: Module | null
path: string
paths: string[]


_compile(content: string, filename: string): any
load(filename: string): void
require(id: string): any

Static Properties

_cache: { [key: string]: Module; }
_extensions: { [key: string]: (module: Module, filename: string) => any; }
builtinModules: string[]
globalPaths: string[]
wrapper: string[]

Static Methods

request: string,
paths: string[],
isMain: boolean,
): string | boolean
_initPaths(): void
request: string,
parent: Module,
isMain: boolean,
): any
_nodeModulePaths(from: string): string[]
_preloadModules(requests: string[]): void
request: string,
parent: Module,
isMain: boolean,
options?: { paths: string[]; },
): string
_resolveLookupPaths(request: string, parent: Module | null): string[] | null
createRequire(filename: string | URL): RequireFunction

Create a require function that can be used to import CJS modules. Follows CommonJS resolution similar to that of Node.js, with node_modules lookup and index.js lookup support. Also injects available Node.js builtin module polyfills.

const require = createRequire(import.meta.url);
const fs = require("fs");
const leftPad = require("left-pad");
const cjsModule = require("./cjs_mod");
wrap(script: string): string