Skip to content

Commit

Permalink
Rescue require('pnpapi')
Browse files Browse the repository at this point in the history
  • Loading branch information
louisscruz committed Jun 14, 2022
1 parent ddc96f8 commit e5eebfc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/ResolverFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,13 @@ function processPnpApiOption(option) {
option === undefined &&
/** @type {NodeJS.ProcessVersions & {pnp: string}} */ versions.pnp
) {
// @ts-ignore
return require("pnpapi"); // eslint-disable-line node/no-missing-require
try {
// @ts-ignore
return require("pnpapi"); // eslint-disable-line node/no-missing-require
} catch (e) {
// In some rare cases, versions.pnp might be set, but it might not be possible to resolve `pnpapi`
return null;
}
}

return option || null;
Expand Down

0 comments on commit e5eebfc

Please sign in to comment.