Switch yarn to project-local cache so .pnp.cjs paths are stable across machines#158
Merged
Conversation
Contributor
Danger ReportNo issues found. |
There was a problem hiding this comment.
Pull request overview
This PR aims to make the Yarn Berry/PnP install artifacts portable by switching from Yarn’s global cache to a project-local cache, so .pnp.cjs no longer embeds machine-specific paths that break when the repo is cloned at a different directory depth.
Changes:
- Add
.yarnrc.ymlto disable Yarn’s global cache (enableGlobalCache: false) so packages are stored under./.yarn/cache. - Update
.pnp.cjsto reference project-relative cache paths instead of../../.yarn/berry/cache/.... - Update
.gitignoreto ignore most of.yarn/while explicitly tracking.yarn/cacheand.yarn/unpluggedfor “zero-install” style checkouts, and add unplugged esbuild artifacts.
Reviewed changes
Copilot reviewed 1 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
.yarnrc.yml |
Configures Yarn to use a project-local cache. |
.pnp.cjs |
Rewrites cached package locations to ./.yarn/cache/... paths. |
.gitignore |
Stops blanket-ignoring .yarn and instead tracks cache/unplugged directories. |
.yarn/unplugged/@esbuild-darwin-arm64-.../README.md |
Adds unplugged (vendored) esbuild platform package docs. |
.yarn/unplugged/@esbuild-darwin-arm64-.../package.json |
Adds unplugged (vendored) esbuild platform package metadata. |
Files not reviewed (1)
- .pnp.cjs: Language not supported
dblock
requested changes
May 18, 2026
Contributor
Author
I have locally weird change - maybe I should just push the change instead of applying these changes
- #161
|
Contributor
Author
you're right, the zips were left over from experimenting with zero-installs - the path-stability fix doesn't need them, removing. |
.pnp.cjs paths are stable across machines
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.

.yarnrc.yml, Yarn defaults to the user-level global cache (~/.yarn/berry/cache/), so.pnp.cjsends up withpackageLocationpaths like../../.yarn/berry/cache/...that are relative to wherever the repo was cloned. Every contributor whose checkout sits at a different depth from~/regenerates.pnp.cjsand produces a spurious diff..yarnrc.ymlwithenableGlobalCache: falseso the cache lives at./.yarn/cache/and.pnp.cjsrecords portable./.yarn/cache/...paths..yarn/stays gitignored - contributors still runyarn installonce after cloning, same as today. This is not a zero-installs change; no cache zips or unplugged binaries are committed.