Skip to main content


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)
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
request: string,
parent: Module,
isMain: boolean,
): any
_nodeModulePaths(from: string): string[]
_preloadModules(requests: string[])
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.

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