The exports field decides what your package lets you import
Without it every file is importable, and @acme/ui/dist/internal/cache.js becomes a path you keep working.
{
"exports": {
".": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
"./icons": { "types": "./dist/icons.d.ts", "default": "./dist/icons.js" },
"./package.json": "./package.json"
}
}Anything not listed stops resolving, so a deep import breaks at build time instead of becoming a contract. Conditions match in order, so types goes first in each entry, and keep ./package.json exported because tooling reads it.
nodejstooling