Summary
require('apecs') throws on Node 20.19 (the engines floor), even though Node supports require(esm) there.
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in node_modules/apecs/package.json
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
Cause
Every entry in the exports map in package.json declares only types and import. There is no require or default condition, so a CommonJS resolver finds no match at all. This affects any CJS consumer: Jest without ESM mode, older bundler configs, ts-node in CJS mode, and plain require in Node scripts.
Repro
mkdir smoke && cd smoke && npm init -y && npm i apecs@0.1.0
node -e "console.log(require('apecs').VERSION)"
Suggested fix
Add a default condition to each subpath pointing at the same ESM file. Node >= 20.19 resolves it through require(esm):
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"default": "./dist/index.js"
}
Same for ./react, ./solid and ./internal. No CJS build is needed. Found by a post-publish smoke test of 0.1.0.
Summary
require('apecs')throws on Node 20.19 (theenginesfloor), even though Node supportsrequire(esm)there.Cause
Every entry in the
exportsmap inpackage.jsondeclares onlytypesandimport. There is norequireordefaultcondition, so a CommonJS resolver finds no match at all. This affects any CJS consumer: Jest without ESM mode, older bundler configs,ts-nodein CJS mode, and plainrequirein Node scripts.Repro
Suggested fix
Add a
defaultcondition to each subpath pointing at the same ESM file. Node >= 20.19 resolves it throughrequire(esm):Same for
./react,./solidand./internal. No CJS build is needed. Found by a post-publish smoke test of 0.1.0.