- Type: {string}
{
"main": "./main.js"
}
The "main"
field defines the script that is used when the package directory
is loaded via require()
. Its value
is a path.
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.