Setting the name
property in package.json
will define the label reference.
main
attribute defines the entrypoint location of the name
.
// without scoping in name { "name": "package_name", "main": "src/index.ts" } // with scoping in name { "name": "@scope_name/package_name", "main": "src/index.ts" }
Referencing the named package in other code location:
import config from 'package_name/config';
If there is a scope attached to the parent directory:
import config from '@scope_name/package_name/config';