Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 687 Bytes

is-builtin-module.md

File metadata and controls

30 lines (20 loc) · 687 Bytes

is-builtin-module

is-builtin-module has equivalent functionality built in to node itself.

You may not need an alternative if your runtime does not have access to the built-in node module.

Alternatives

NodeJS (since 16.x)

For determining if a module is built-in or not, you can use isBuiltIn:

import {isBuiltin} from 'node:module';

isBuiltin('fs'); // true

For a full list of built-in modules, you can use builtinModules:

import {builtinModules} from 'node:module';

for (const name of builtinModules) {
  console.log(name);
}