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 <artem.i@protoq.dev>
temez committed
Jul 31, 2025 at 20:29 UTC
4c574b89e23515d8411e5ec52624d6a932b874e0
1 file changed
+6
content/cli/v11/configuring-npm/package-json.mdx
+6
@@ -305,6 +305,12 @@ These can not be included.
305
306
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)
307
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
+
314
### main
315
316
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.