| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6cc4cf8 commit 0c08835
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -76,10 +76,11 @@ Node.js has two module systems: CommonJS modules and [ECMAScript modules][]. | |||
| 76 | 76 | ||
| 77 | 77 | By default, Node.js will treat the following as CommonJS modules: | |
| 78 | 78 | ||
| 79 | - * Files with a `.cjs` extension; | ||
| 79 | + * Files with a `.cjs` extension. | ||
| 80 | 80 | ||
| 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"`. | ||
| 83 | 84 | ||
| 84 | 85 | * Files with a `.js` extension or without an extension, when the nearest parent | |
| 85 | 86 | `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: | |||
| 90 | 91 | tools and loaders to determine how the files in the package should be | |
| 91 | 92 | interpreted. | |
| 92 | 93 | ||
| 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"`. | ||
| 98 | 97 | ||
| 99 | 98 | See [Determining module system][] for more details. | |
| 100 | 99 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments