From f0fb1b3d45f13b45c421e870af73ee3139994f9d Mon Sep 17 00:00:00 2001 From: Chao Guo <10736839+g-chao@users.noreply.github.com> Date: Thu, 9 May 2024 14:34:33 -0700 Subject: [PATCH] chore: to prevent a edge case that the injected dependency is not start with file --- packages/pnpm-sync-lib/src/pnpmSyncPrepare.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/pnpm-sync-lib/src/pnpmSyncPrepare.ts b/packages/pnpm-sync-lib/src/pnpmSyncPrepare.ts index 5a89952..c465fcf 100644 --- a/packages/pnpm-sync-lib/src/pnpmSyncPrepare.ts +++ b/packages/pnpm-sync-lib/src/pnpmSyncPrepare.ts @@ -296,7 +296,11 @@ function processDependencies( for (const [dependency, specifier] of Object.entries(dependencies)) { if (injectedDependencyToVersion.has(dependency)) { const specifierToUse: string = typeof specifier === 'string' ? specifier : specifier.version; - injectedDependencyToVersion.get(dependency)?.add(specifierToUse); + + // the injected dependency should always start with file protocol + if (specifierToUse.startsWith('file:')) { + injectedDependencyToVersion.get(dependency)?.add(specifierToUse); + } } } }