From 5c3a443a6ffe7972ad52758bb591c79205333ca3 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Tue, 10 Mar 2026 08:09:38 +0100 Subject: [PATCH] doc: remove extensionless CJS exception for type:module packages Remove the documented exception that extensionless files in type: "module" packages are recognized as CommonJS when included via require(). This exception conflicted with the ESM resolution specification which states that extensionless files within a package scope with an explicit type field follow the format of the type field. The behavior on main already matches the ESM spec since #61600, this change aligns the CJS documentation accordingly. Refs: https://github.com/nodejs/node/pull/61600 Refs: https://github.com/nodejs/node/pull/62083 --- doc/api/modules.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/api/modules.md b/doc/api/modules.md index 84252b9819d2b4..2d5446f26dc900 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -92,9 +92,8 @@ By default, Node.js will treat the following as CommonJS modules: * Files with an extension that is not `.mjs`, `.cjs`, `.json`, `.node`, or `.js` (when the nearest parent `package.json` file contains a top-level field - [`"type"`][] with a value of `"module"`, those files will be recognized as - CommonJS modules only if they are being included via `require()`, not when - used as the command-line entry point of the program). + [`"type"`][] with a value of `"module"`, those files will not be recognized as + CommonJS modules). See [Determining module system][] for more details.