File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -1138,17 +1138,19 @@ added: v0.4.0
11381138}
11391139```
11401140
1141- The `"main"` field defines the script that is used when the [package directory
1142- is loaded via `require()`](modules.md#folders-as-modules). Its value
1143- is a path.
1141+ The `"main"` field defines the entry point of a package when imported by name
1142+ via a `node_modules` lookup. Its value is a path.
1143+
1144+ When a package has an [`"exports"`][] field, this will take precedence over the
1145+ `"main"` field when importing the package by name.
1146+
1147+ It also defines the script that is used when the [package directory is loaded
1148+ via `require()`](modules.md#folders-as-modules).
11441149
11451150```cjs
11461151require('./path/to/directory'); // This resolves to ./path/to/directory/main.js.
11471152```
11481153
1149- When a package has an [`"exports"`][] field, this will take precedence over the
1150- `"main"` field when importing the package by name.
1151-
11521154### `"packageManager"`
11531155
11541156<!-- YAML
You can’t perform that action at this time.
0 commit comments