fix(core): don't fail on skipped optional deps, when calculating depsRequiringBuild (#8390)

This commit is contained in:
Zoltan Kochan
2024-08-08 14:04:47 +02:00
committed by GitHub
parent 449041c5aa
commit 8e055d2f05
2 changed files with 8 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
---
"@pnpm/core": patch
---
Don't fail on skipped optional dependencies, when searching for dependencies that should be built.

View File

@@ -1419,8 +1419,9 @@ const _installInContext: InstallFunction = async (projects, ctx, opts) => {
await waitTillAllFetchingsFinish()
const depsRequiringBuild: DepPath[] = []
if (opts.returnListOfDepsRequiringBuild) {
await Promise.all(Object.entries(dependenciesGraph).map(async ([depPath, { fetching }]) => {
const { files } = await fetching()
await Promise.all(Object.entries(dependenciesGraph).map(async ([depPath, node]) => {
if (node == null) return // We cannot detect if a skipped optional dependency requires build
const { files } = await node.fetching()
if (files.requiresBuild) {
depsRequiringBuild.push(depPath as DepPath)
}