diff --git a/doc/api/packages.md b/doc/api/packages.md index 6b38d238dc9949..7a25699c55a1f9 100644 --- a/doc/api/packages.md +++ b/doc/api/packages.md @@ -1138,17 +1138,19 @@ added: v0.4.0 } ``` -The `"main"` field defines the script that is used when the [package directory -is loaded via `require()`](modules.md#folders-as-modules). Its value -is a path. +The `"main"` field defines the entry point of a package when imported by name +via a `node_modules` lookup. Its value is a path. + +When a package has an [`"exports"`][] field, this will take precedence over the +`"main"` field when importing the package by name. + +It also defines the script that is used when the [package directory is loaded +via `require()`](modules.md#folders-as-modules). ```cjs require('./path/to/directory'); // This resolves to ./path/to/directory/main.js. ``` -When a package has an [`"exports"`][] field, this will take precedence over the -`"main"` field when importing the package by name. - ### `"packageManager"`