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 @@ -1093,17 +1093,19 @@ added: v0.4.0
10931093}
10941094```
10951095
1096- The ` "main" ` field defines the script that is used when the [ package directory
1097- is loaded via ` require() ` ] ( modules.md#folders-as-modules ) . Its value
1098- is a path.
1096+ The ` "main" ` field defines the entry point of a package when imported by name
1097+ via a ` node_modules ` lookup. Its value is a path.
1098+
1099+ When a package has an [ ` "exports" ` ] [ ] field, this will take precedence over the
1100+ ` "main" ` field when importing the package by name.
1101+
1102+ It also defines the script that is used when the [ package directory is loaded
1103+ via ` require() ` ] ( modules.md#folders-as-modules ) .
10991104
11001105``` cjs
11011106require (' ./path/to/directory' ); // This resolves to ./path/to/directory/main.js.
11021107```
11031108
1104- When a package has an [ ` "exports" ` ] [ ] field, this will take precedence over the
1105- ` "main" ` field when importing the package by name.
1106-
11071109### ` "packageManager" `
11081110
11091111<!-- YAML
You can’t perform that action at this time.
0 commit comments