diff --git a/doc/api/packages.md b/doc/api/packages.md index a24c99f1eeb783..4638c7cc28d9a2 100644 --- a/doc/api/packages.md +++ b/doc/api/packages.md @@ -1093,17 +1093,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"`