node:module

Node's module helpers, with stubbed source-map and loader APIs.

node:module exports createRequire, isBuiltin, builtinModules, and the rest of Node’s module helpers.

Differences from Node

  • createRequire returns the realm’s require; relative paths do not resolve against the filename passed to it.
  • syncBuiltinESMExports() is a no-op.
  • findSourceMap() returns undefined; getSourceMapsSupport() reports source maps disabled.
  • Loader customization hooks (register) are not supported.
  • require.resolve() returns the specifier unchanged for built-ins.