The order slip on the workshop bench: ban-dodi’s package.json and who reads which line. This page’s own JSON.parse, exports and main as Node 22 looks them up…
Many "works on my laptop, breaks once installed" errors come from package.json: one comma, an exports missing a path, a type that takes require away, a dist left behind at publish time. Knowing who reads which line makes those errors readable.
package.json has many readers, each reading its own part
exports, then a file that could be imported fails Once exports is there, only the paths written in it can be reached: ban-dodi/dist/index.cjs is refused with ERR_PACKAGE_PATH_NOT_EXPORTED although the file is there. Write every public subpath, or one pattern such as "./suku/*": "./dist/suku/*.js"."type": "module", then require() throws a ReferenceError With "type": "module", every .js is read as an ES module, and there require, module and __dirname do not exist. Use import, or give the CommonJS file a .cjs extension.files, npm uses .gitignore: if dist/ is in it, the crate is published without dist, and require('ban-dodi') stops with Cannot find module. Write "files": ["dist"], then check the contents with npm pack --dry-run before npm publish.exports, ban-dodi/dist/index.cjs is refused although the file is there.default first Conditions are tried in order: an import under default is never reached.import with no type Node 22 guesses from what the file holds, and warns.