Skip to content

Commit 1d63497

Browse files
committed
doc: further clarify package.json "type" field
Added sentence about the type field not affecting .mjs and .cjs files.
1 parent fccd01b commit 1d63497

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

doc/api/esm.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ future-proof the package in case the default type of Node.js ever changes, and
101101
it will also make things easier for build tools and loaders to determine how the
102102
files in the package should be interpreted.
103103

104+
Regardless of the value of the `"type"` field, `.mjs` files are always treated
105+
as ES modules and `.cjs` files are always treated as CommonJS modules.
106+
104107
### Package Scope and File Extensions
105108

106109
A folder containing a `package.json` file, and all subfolders below that

0 commit comments

Comments
 (0)