feat: use global virtual store for global packages and dlx#10694
Merged
feat: use global virtual store for global packages and dlx#10694
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces support for using a global virtual store for global package installations (pnpm install -g) and pnpm dlx commands. Previously, these operations created .pnpm directories in individual project locations. With this change, packages are now stored centrally at {storeDir}/links by default, improving performance and reducing disk space usage across multiple dlx invocations and global installs.
Changes:
- Global installs and dlx now default to using the global virtual store (stored at
{storeDir}/links) - Added
enableGlobalVirtualStoreconfiguration option that can be set to false to revert to the old behavior - CI environments automatically disable the global virtual store since there's no benefit from a warm cache
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| config/config/src/index.ts | Implements logic to set enableGlobalVirtualStore to true by default for global installs, and conditionally sets virtualStoreDir to .pnpm when the global virtual store is disabled |
| exec/plugin-commands-script-runners/src/dlx.ts | Updates dlx handler to default enableGlobalVirtualStore to true when not explicitly set |
| exec/plugin-commands-script-runners/test/dlx.e2e.ts | Updates tests that verify build script behavior to explicitly disable the global virtual store, as they check for files in specific .pnpm paths |
| .changeset/global-install-virtual-store.md | Documents the feature change for the changelog |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…nstalls When the global virtual store is disabled, the default `node_modules/.pnpm` path works fine — no need to explicitly override it to `.pnpm`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Global installs (
pnpm add -g) andpnpm dlxnow use the global virtual store by default. Instead of creating a.pnpmdirectory inside each install location, packages are stored in the content-addressable store and hard-linked from{storeDir}/links. This makes global installs anddlxfaster when packages share common dependencies, as they are deduplicated through the store.Changes
enableGlobalVirtualStoreby default for global installs. When disabled, the standardnode_modules/.pnpmlayout is used instead of hardcoding.pnpm.enableGlobalVirtualStorethrough to theaddhandler sodlxalso benefits from the virtual store.enableGlobalVirtualStore: falsein dlx tests that rely on the non-virtual-store layout.Opt out
Run
pnpm config set enableGlobalVirtualStore falseto use the previous behavior. This is also automatically disabled in CI environments, where there is no warm cache to benefit from.