Skip to content

Commit

Permalink
update ERR_PACKAGE_PATH_NOT_EXPORTED check
Browse files Browse the repository at this point in the history
  • Loading branch information
FredKSchott committed Mar 5, 2020
1 parent 9b6704b commit 7de9470
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,12 @@ export function resolveDependencyManifest(dep: string, cwd: string) {
const depManifest = require.resolve(`${dep}/package.json`, {paths: [cwd]});
return [depManifest, require(depManifest)];
} catch (err) {
if (err.code === 'MODULE_NOT_FOUND' && err.message.includes(`'./package.json'`)) {
if (
(err.code === 'MODULE_NOT_FOUND' || err.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED') &&
err.message.includes(`'./package.json'`)
) {
// its most likely an export map issue, move on to our manual resolver.
// TODO(03-2020): Remove MODULE_NOT_FOUND check (only needed for Node v13.1-v13.9).
} else {
throw err;
}
Expand Down

0 comments on commit 7de9470

Please sign in to comment.