package.json exports
The package.json fields that declare which files a package makes importable (exports) and which private shortcuts start with # (imports).
In more detail
exports lets a package say that only lib/index.js may be imported, and under which subpaths such as my-lib/utils. imports defines internal aliases such as #db. NodeNext module resolution respects both, so TypeScript reports imports that Node.js would refuse.
Related terms
- package.json — The JSON file at the root of every JavaScript package that records its name, version, dependencies, entry points and other settings.
- NodeNext — A module and moduleResolution setting that makes TypeScript follow exactly the module rules of current Node.js.
- module resolution — How a runtime or tool turns the name in an import, such as ./util.js or express, into the exact file to load.
Taught in
- tsconfig.json: target, lib, strict And NodeNext — Production TypeScript