Stability: 1 - Experimental

    When using the ["exports"][] field, custom subpaths can be defined along with the main entry point by treating the main entry point as the "." subpath:

    1. {
    2. "main": "./main.js",
    3. "exports": {
    4. ".": "./main.js",
    5. "./submodule": "./src/submodule.js"
    6. }
    7. }

    Now only the defined subpath in ["exports"][] can be imported by a consumer:

    1. import submodule from 'es-module-package/submodule';
    2. // Loads ./node_modules/es-module-package/src/submodule.js

    While other subpaths will error:

    1. import submodule from 'es-module-package/private-module.js';
    2. // Throws ERR_PACKAGE_PATH_NOT_EXPORTED