Skip to content

Commit 4c574b8

Browse files
temezpq-artem-i
andauthored
docs: add docs for package.json/type (#1687)
This PR adds comprehensive documentation for the type field in package.json ## References Closes #1204 Co-authored-by: Artem I <[email protected]>
1 parent 78e78d6 commit 4c574b8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

content/cli/v11/configuring-npm/package-json.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,12 @@ These can not be included.
305305

306306
The "exports" provides a modern alternative to "main" allowing multiple entry points to be defined, conditional entry resolution support between environments, and preventing any other entry points besides those defined in "exports". This encapsulation allows module authors to clearly define the public interface for their package. For more details see the [node.js documentation on package entry points](https://nodejs.org/api/packages.html#package-entry-points)
307307

308+
### type
309+
310+
The `type` field defines the module format that Node.js should use for `.js` files in the package.
311+
312+
For more details, see the [Node.js documentation](https://nodejs.org/api/packages.html#type).
313+
308314
### main
309315

310316
The main field is a module ID that is the primary entry point to your program. That is, if your package is named `foo`, and a user installs it, and then does `require("foo")`, then your main module's exports object will be returned.

0 commit comments

Comments
 (0)