fix: don't relink injected packages if they were not built (#5792)

This commit is contained in:
Zoltan Kochan
2022-12-13 21:47:37 +02:00
committed by GitHub
parent 90ec7fcf3f
commit 6b00a83256
2 changed files with 9 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/lifecycle": patch
"pnpm": patch
---
Don't relink injected directories if they were not built.

View File

@@ -49,11 +49,13 @@ export async function runLifecycleHooksConcurrently (
pkgRoot: rootDir,
rootModulesDir: modulesDir,
}
let isBuilt = false
for (const stage of (importerStages ?? stages)) {
if ((manifest.scripts == null) || !manifest.scripts[stage]) continue
await runLifecycleHook(stage, manifest, runLifecycleHookOpts)
isBuilt = true
}
if (targetDirs == null || targetDirs.length === 0) return
if (targetDirs == null || targetDirs.length === 0 || !isBuilt) return
const filesResponse = await fetchFromDir(rootDir, { resolveSymlinks: opts.resolveSymlinksInInjectedDirs })
await Promise.all(
targetDirs.map(async (targetDir) => {