Node 24.18 ERR_PACKAGE_PATH_NOT_EXPORTED: 'Package subpath './lib/secret.js' is not defined by 'exports'' (CJS and ESM), './package.json' blocked too
Tested on Windows 11, Node 24.18.0 with a local package whose package.json has exports { '.': './lib/main.js', './feature': './lib/feature.js' }. require('pk/lib/secret.js') -> 'Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/secret.js' is not defined by 'exports' in <dir>/node_modules/pk/package.json'. ESM import 'pk/lib/secret.js' gives the same text with ' imported from <file>' appended. require('pk/package.json') fails the same way (add './package.json': './package.json' to exports to allow it). require('pk/feature') works. A package with a conditional exports map { import: ./dist/index.mjs, require: ./dist/index.cjs } returned the cjs build from require and the esm build from import. A package with no exports field allowed any deep path.