Skip to content

Commit

Permalink
Prefer non-virtual workspace locators, when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
larixer committed Sep 17, 2021
1 parent 9ff124d commit e6a6639
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/yarnpkg-nm/sources/buildNodeModulesTree.ts
Expand Up @@ -185,8 +185,13 @@ const buildWorkspaceMap = (pnp: PnpApi): WorkspaceMap => {

const pkg = pnp.getPackageInformation(locator);
if (pkg) {
if (pkg.linkType === LinkType.SOFT && !isExternalSoftLink(pkg, locator, pnp, topPkgPortableLocation))
workspaceLikeLocators.set(getRealPackageLocation(pkg, locator, pnp), locator);
if (pkg.linkType === LinkType.SOFT && !isExternalSoftLink(pkg, locator, pnp, topPkgPortableLocation)) {
const realLocation = getRealPackageLocation(pkg, locator, pnp);
// Prefers usage of non-virtual locators for the layout of nested workspaces on the file system.
if (!workspaceLikeLocators.has(realLocation) || !locator.reference.startsWith(`virtual:`)) {
workspaceLikeLocators.set(realLocation, locator);
}
}

for (const [name, referencish] of pkg.packageDependencies) {
if (referencish !== null) {
Expand Down

0 comments on commit e6a6639

Please sign in to comment.