Skip to content

Commit

Permalink
fix: ignore pnp resolve error (#12719)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Apr 3, 2023
1 parent 0ce0e93 commit 2d30ae5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/vite/src/node/packages.ts
Expand Up @@ -60,7 +60,12 @@ export function resolvePackageData(
const cacheKey = getRpdCacheKey(pkgName, basedir, preserveSymlinks)
if (packageCache?.has(cacheKey)) return packageCache.get(cacheKey)!

const pkg = pnp.resolveToUnqualified(pkgName, basedir)
let pkg: string | null
try {
pkg = pnp.resolveToUnqualified(pkgName, basedir)
} catch {
return null
}
if (!pkg) return null

const pkgData = loadPackageData(path.join(pkg, 'package.json'))
Expand Down

0 comments on commit 2d30ae5

Please sign in to comment.