[rush] Fix cross-subspace workspace:* dependencies failing under pnpm 11 (globalPnpmfile via pnpm-workspace.yaml) - #5913
Merged
Bharat Middha (bmiddha) merged 2 commits intoAug 6, 2026
Conversation
…t globalPnpmfile via pnpm-workspace.yaml)
Jérémy Dieuze (QuanticPotatoes)
requested review from
Bharat Middha (bmiddha),
David Michon (dmichon-msft) and
Jonathon Anthony (jxanthony)
as code owners
August 4, 2026 08:38
Contributor
Author
|
@microsoft-github-policy-service agree company="Abby" |
There was a problem hiding this comment.
Pull request overview
Fixes pnpm 11 cross-subspace workspace:* resolution by configuring Rush’s global pnpmfile through pnpm-workspace.yaml.
Changes:
- Adds
globalPnpmfileserialization and loading support. - Emits the pnpmfile path for pnpm 11 subspace installs.
- Adds fixtures, tests, snapshots, and release notes.
Show a summary per file
| File | Description |
|---|---|
libraries/rush-lib/src/logic/test/pnpmConfigPnpm11Subspaces/rush.json |
Adds pnpm 11 test fixture. |
libraries/rush-lib/src/logic/test/pnpmConfigPnpm11Subspaces/common/config/subspaces/default/pnpm-config.json |
Adds default subspace configuration. |
libraries/rush-lib/src/logic/test/pnpmConfigPnpm11Subspaces/common/config/rush/subspaces.json |
Enables subspaces in the fixture. |
libraries/rush-lib/src/logic/test/pnpmConfigPnpm11Subspaces/common/config/rush/pnpm-config.json |
Enables workspace mode. |
libraries/rush-lib/src/logic/test/InstallHelpers.test.ts |
Tests version and subspace gating. |
libraries/rush-lib/src/logic/test/__snapshots__/InstallHelpers.test.ts.snap |
Updates terminal snapshots. |
libraries/rush-lib/src/logic/pnpm/test/PnpmWorkspaceFile.test.ts |
Tests serialization and loading. |
libraries/rush-lib/src/logic/pnpm/test/__snapshots__/PnpmWorkspaceFile.test.ts.snap |
Captures generated YAML. |
libraries/rush-lib/src/logic/pnpm/PnpmWorkspaceFile.ts |
Supports the globalPnpmfile setting. |
libraries/rush-lib/src/logic/installManager/InstallHelpers.ts |
Configures the global pnpmfile for pnpm 11 subspaces. |
libraries/rush-lib/src/logic/base/BaseInstallManager.ts |
Documents legacy .npmrc behavior. |
common/changes/@microsoft/rush/fix-pnpm11-subspace-global-pnpmfile_2026-08-04-08-30-00.json |
Records the user-facing fix. |
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 0
- Review effort level: Balanced
Bharat Middha (bmiddha)
approved these changes
Aug 6, 2026
Bharat Middha (bmiddha)
enabled auto-merge (squash)
August 6, 2026 03:23
Bharat Middha (bmiddha)
disabled auto-merge
August 6, 2026 03:23
Bharat Middha (bmiddha)
enabled auto-merge (squash)
August 6, 2026 03:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #5912.
With subspaces enabled, Rush generates a "global pnpmfile" (
global-pnpmfile.cjs) that rewrites cross-subspaceworkspace:*dependency specifiers tolink:specifiers. It is wired up via aglobal-pnpmfile=line in the generated.npmrc— but pnpm 11 only reads auth/registry settings from.npmrc, so the hook never loads and installation fails on the first subspace that carries a cross-subspace dependency:This is the counterpart of #5838 for the pnpmfile wiring: for pnpm 11+, the path is now emitted via the
globalPnpmfilesetting of the generatedpnpm-workspace.yaml(which pnpm 11 still supports — and unlike thepnpmfilesetting, it does not disable the default.pnpmfile.cjsloading, so the per-subspace user pnpmfile shim keeps working). Behavior for pnpm 10 and earlier is unchanged: the.npmrcline is still written (pnpm 11 ignores it).Details
PnpmWorkspaceFile: newglobalPnpmfilefield (serialize +tryLoadAsync).InstallHelpers.resolvePnpmSettings: whenisPnpm11 && subspacesFeatureEnabled, setsworkspaceFile.globalPnpmfileto<subspace temp folder>/global-pnpmfile.cjs— same relocation pattern as the [rush] Relocate pnpm settings to pnpm-workspace.yaml for pnpm 11 #5838 settings.BaseInstallManager: comment documenting that the.npmrcline only reaches pnpm ≤ 10.How it was tested
rush-libfull suite: 724 passed / 0 failed. New tests:PnpmWorkspaceFileserialize + round-trip forglobalPnpmfile;InstallHelpersemits the path for pnpm 11 + subspaces (newpnpmConfigPnpm11Subspacesfixture), and does not emit it for pnpm 11 without subspaces nor for pnpm < 11 with subspaces.workspace:*dev-tooling deps) on pnpm 11.17.0: without the setting,rush updatefails withERR_PNPM_WORKSPACE_PKG_NOT_FOUND; withglobalPnpmfileappended to the generatedpnpm-workspace.yaml(what this PR automates), the same install resolves cleanly.🤖 Generated with Claude Code