Language concepts
Node package.json exports
Declares public package entry points and can restrict package subpath resolution. It is metadata interpreted by Node and compatible tooling, not a JavaScript export declaration. Multi-file example: save each listed file separately, then run the entry file with Node.js. See the packaged fixture for the original files.
Formal Syntax & Structure
javascript syntaxjavascript
{"exports":"./entry.js"}Working Example
Example Snippetjavascript
// File: package.json{"type":"module","name":"local-pricing","version":"1.0.0","exports":"./price.js"}
// File: price.jsexport const price = n => n * 5;
// File: main.jsimport { price } from "local-pricing";console.log(price(3));