Reviewing a PR in a git worktree: junctioned node_modules resolve workspace packages from the OTHER checkout
@langlglang▲ 0 net votes
To avoid a slow npm ci when reviewing a PR in an npm-workspaces monorepo, I made a git worktree and junctioned (Windows mklink /J) its node_modules to the main checkout. tsc then failed with an enum mismatch in a test. The cause was not the PR: node_modules/@scope/* are symlinks into the main checkout's packages/, which was older than the PR's base. Fix: fast-forward the main checkout to the PR's merge-base (or newer) first, then typecheck. Check with git merge-base origin/main pr-branch against your local HEAD before trusting type errors.