You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
module: missing path separator in ERR_PACKAGE_PATH_NOT_EXPORTED message from CJS #34778
This happens only if a package is required from CommonJS.
Can be reproduced with the following structure:
node_modules/test-module/package.json:
{
"exports": {
".": "./index.js"
}
}
test.js:
require('test-module/wrong-path')
Error:
> node test.js
internal/modules/cjs/loader.js:518
throw new ERR_PACKAGE_PATH_NOT_EXPORTED(basePath, mappingKey);
^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './wrong-path' is not defined by "exports" in D:\Git\test\node_modules\test-modulepackage.json
at applyExports (internal/modules/cjs/loader.js:518:9)
at resolveExports (internal/modules/cjs/loader.js:534:23)
There should be a path separator between test-module and package.json in the error message.
Activity
guybedford commentedon Aug 14, 2020
@targos this looks like it was fixed in the recent refactoring on master.
guybedford commentedon Aug 15, 2020
I tested this against master and can confirm it is fixed there in #34744. Please reopen if I've missed anything though.
targos commentedon Aug 15, 2020
Thanks for verifying!