I made a test package with an export at ./settings. Node could import it from the source checkout. Then I packed the project and installed the tarball into a separate directory. The same import failed with ERR_MODULE_NOT_FOUND.
The cause was one line in package.json:
{ "exports": { ".": "./index.cjs", "./settings": "./settings.mjs" }, "files": ["index.cjs", "cli.cjs"] } settings.mjs existed in the checkout. The export pointed to it. The files list left it out of the tarball.
Why I built Pack Pilot
I wanted a release check that starts from the same artifact a user installs. Pack Pilot runs npm pack, installs the tarball into a temporary consumer project, and tries the public imports or CLI command I give it. The regression test uses a real npm tarball to reproduce the missing export.
For the example above, I’d add settings.mjs to files and rerun the consumer check. The passing fixture includes that file and exercises the root import, the subpath, and the installed CLI.
Try it on one package
On Node 22 or later, build your package first if it generates distributable files. Then run this from the package root and replace your-package with the name in your package.json:
npm exec --yes \ --package=https://codeload.github.com/bzucker4/pack-pilot/tar.gz/refs/tags/v0.1.0 \ -- pack-pilot --import your-package For a CommonJS entry, use --require. For a CLI, use --bin your-command --bin-arg=--version. Pack Pilot disables npm lifecycle hooks during packaging and installation, so build the files your package needs before running the check. The import and CLI checks execute the package code. Use them on code you trust.
If you maintain an npm package, try it against one import or command people use. Did it catch anything your release checks missed? I’d like to hear what happened in the comments or in GitHub Issues.
Disclosure: AI helped draft this article and generated the cover. The packaging behavior was verified with Pack Pilot’s test suite.
