Skip to content

Commit 9342855

Browse files
committed
doc: fix duplicated wording in modules.md
1 parent 21ce4fb commit 9342855

File tree

1 file changed

+6
-27
lines changed

1 file changed

+6
-27
lines changed

doc/api/modules.md

Lines changed: 6 additions & 27 deletions
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,31 +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 not be recognized as
96-
By default, Node.js will treat the following as CommonJS modules:
97-
98-
* Files with a `.cjs` extension.
99-
100-
* Files with a `.js` extension or without an extension, when the nearest parent
101-
`package.json` file contains a top-level field [`"type"`][] with a value of
102-
`"commonjs"`.
103-
104-
* Files with a `.js` extension or without an extension, when the nearest parent
105-
`package.json` file doesn't contain a top-level field [`"type"`][] or there is
106-
no `package.json` in any parent folder; unless the file contains syntax that
107-
errors unless it is evaluated as an ES module. Package authors should include
108-
the [`"type"`][] field, even in packages where all sources are CommonJS. Being
109-
explicit about the `type` of the package will make things easier for build
110-
tools and loaders to determine how the files in the package should be
111-
interpreted.
112-
11394
* Files with an extension that is not `.mjs`, `.cjs`, `.json`, `.node`, or `.js`,
114-
when the nearest parent `package.json` file contains a top-level field
115-
[`"type"`][] with a value of `"module"`.
116-
117-
See [Determining module system][] for more details.
95+
when the nearest parent `package.json` file contains a top-level field
96+
[`"type"`][] with a value of `"module"`.
11897

11998
Calling `require()` always use the CommonJS module loader. Calling `import()`
12099
always use the ECMAScript module loader.

0 commit comments

Comments
 (0)