GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc: remove extensionless CJS exception for type:module packages · nodejs/node@0c08835

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • modules.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/modules.md‎

Copy file name to clipboardExpand all lines: doc/api/modules.md
+7-8Lines changed: 7 additions & 8 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,11 @@ Node.js has two module systems: CommonJS modules and [ECMAScript modules][].
7676

7777
By default, Node.js will treat the following as CommonJS modules:
7878

79-
* Files with a `.cjs` extension;
79+
* Files with a `.cjs` extension.
8080

81-
* Files with a `.js` extension when the nearest parent `package.json` file
82-
contains a top-level field [`"type"`][] with a value of `"commonjs"`.
81+
* Files with a `.js` extension or without an extension, when the nearest parent
82+
`package.json` file contains a top-level field [`"type"`][] with a value of
83+
`"commonjs"`.
8384

8485
* Files with a `.js` extension or without an extension, when the nearest parent
8586
`package.json` file doesn't contain a top-level field [`"type"`][] or there is
@@ -90,11 +91,9 @@ By default, Node.js will treat the following as CommonJS modules:
9091
tools and loaders to determine how the files in the package should be
9192
interpreted.
9293

93-
* Files with an extension that is not `.mjs`, `.cjs`, `.json`, `.node`, or `.js`
94-
(when the nearest parent `package.json` file contains a top-level field
95-
[`"type"`][] with a value of `"module"`, those files will be recognized as
96-
CommonJS modules only if they are being included via `require()`, not when
97-
used as the command-line entry point of the program).
94+
* Files with an extension that is not `.mjs`, `.cjs`, `.json`, `.node`, or `.js`,
95+
when the nearest parent `package.json` file contains a top-level field
96+
[`"type"`][] with a value of `"module"`.
9897

9998
See [Determining module system][] for more details.
10099

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.