Skip to content

Conversation

@Phillip9587
Copy link
Member

Align with changes introduced in expressjs/express#6236 by prefixing all built-in Node.js module imports with 'node:'.

Reference: expressjs/express#6236

Taken from that PR:

Since v5 relies on node >= 18, this is now possible (since v16, v14.18.0 1 2).

It's functionally irrelevant:

  1. It's not required for CJS nor ESM (with a few exceptions 3)
  2. It has no performance promises

However, there are upsides to this approach:

  1. It brings clear boundaries to what's a built-in and what's an external dependency
  2. It reduces the risk of importing unwanted deps where a built-in is expected
  3. It's slightly more interoperable with other JS runtimes that provide node compatibility4, albeit only during development. Once imported from npm, built-ins are assumed.

Footnotes

  1. https://nodejs.org/docs/latest-v22.x/api/modules.html#built-in-modules
  2. module: add support for node:‑prefixed require(…) calls nodejs/node#37246
  3. https://nodejs.org/api/modules.html#built-in-modules-with-mandatory-node-prefix
  4. https://docs.deno.com/runtime/fundamentals/node/#using-node's-built-in-modules

Align with changes introduced in expressjs/express#6236 by prefixing all built-in Node.js module imports with 'node:'.

Reference: expressjs/express#6236
@wesleytodd wesleytodd merged commit 91c9199 into expressjs:master Jan 23, 2025
9 checks passed
@UlisesGascon UlisesGascon mentioned this pull request Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants