Stability: 1 - Experimental

    • Type: {Object} | {string} | {string[]}
    1. {
    2. "exports": "./index.js"
    3. }

    The "exports" field allows defining the [entry points][] of a package when imported by name loaded either via a node_modules lookup or a [self-reference][] to its own name. It is supported in Node.js 12+ as an alternative to the ["main"][] that can support defining [subpath exports][] and [conditional exports][] while encapsulating internal unexported modules.

    [Conditional Exports][] can also be used within "exports" to define different package entry points per environment, including whether the package is referenced via require or via import.

    All paths defined in the "exports" must be relative file URLs starting with ./.