Skip to content

fix(create): keep aliased vite in pnpm monorepo website so override stays effective#1728

Merged
fengmk2 merged 5 commits into
mainfrom
fix/create-pnpm-monorepo-vite-override
Jun 1, 2026
Merged

fix(create): keep aliased vite in pnpm monorepo website so override stays effective#1728
fengmk2 merged 5 commits into
mainfrom
fix/create-pnpm-monorepo-vite-override

Conversation

@fengmk2
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 commented Jun 1, 2026

Summary

In a monorepo created via vp create vite:monorepo with pnpm, running vp why vite reported the override as ineffective: it resolved vite to upstream vite (a transitive dependency of @voidzero-dev/vite-plus-core) rather than to @voidzero-dev/vite-plus-core itself.

Root cause

PR #1697 added dropAliasedRuntimeDevDeps, which strips vite/vitest from apps/website/package.json for every package manager. For pnpm this removed the only direct vite dependency in a fresh workspace, so the pnpm-workspace.yaml overrides.vite: catalog: entry had no consumer to redirect. The only vite left in the tree was vite-plus-core's own internal vite, so vp why vite showed upstream vite and the override looked ineffective. The single-package app keeps vite: catalog: and resolves correctly.

npm / yarn / bun: confirmed not affected (no fix needed)

I verified their override is effective in both single-app and monorepo: node_modules/vite resolves to @voidzero-dev/vite-plus-core, and <pm> why @voidzero-dev/vite-plus-core shows it redirecting even vite-plus-test's peer vite. Their root overrides/resolutions redirect the transitive/peer vite regardless of a direct dependency. Their vp why vite display gap is a pre-existing limitation of npm explain / yarn why / bun why (they query by resolved package name, not the vite alias key), identical with or without the monorepo strip, so it is out of scope here.

Fix

dropAliasedRuntimeDevDeps now returns early for pnpm, keeping the aliased vite/vitest so the workspace override has a direct consumer. npm/yarn/bun keep stripping the dead-weight keys.

Before / after (vp why vite in a fresh pnpm monorepo)

Before:

vite@8.0.14
└─┬ @voidzero-dev/vite-plus-test@0.1.23
  └─┬ vite-plus@0.1.23
    ...
Found 1 version of vite

After:

@voidzero-dev/vite-plus-core@0.1.23
├─┬ @voidzero-dev/vite-plus-test@0.1.23
│ └─┬ vite-plus@0.1.23
│   └── website@0.0.0 (devDependencies)
...

Verification

  • New unit test packages/cli/src/create/__tests__/monorepo.spec.ts: failed for pnpm before the fix (vite stripped), now passes 4/4 (pnpm keeps, npm/yarn/bun drop).
  • Create + migration unit suite: 234/234 pass; lint clean.
  • End-to-end against a rebuilt global CLI: real vp create vite:monorepo + vp why vite now resolves to @voidzero-dev/vite-plus-core.
  • Global snap test new-vite-monorepo regenerated (website now keeps vite: catalog:); new-vite-monorepo-bun unchanged.
  • CI test-vp-create.yml assertion made pnpm-aware: pnpm must keep vite; npm/yarn/bun must drop vite/vitest.

Note

Low Risk
Scoped to monorepo scaffold post-processing and documentation; behavior change is intentional and covered by unit, snap, and CI checks.

Overview
pnpm monorepo create no longer strips aliased vite/vitest from apps/website/package.json. The logic moves into exported dropAliasedRuntimeDevDeps, which returns early for pnpm so workspace overrides still have a direct vite consumer (fixing misleading vp why vite after vp create vite:monorepo). npm, yarn, and bun still remove those keys after migration.

Migration guidance is updated in docs/guide/migrate.md, vp migrate help, and snap tests to say: on pnpm, keep migrator-aliased vite/vitest; on other package managers, remove them after import rewrites.

CI (test-vp-create.yml) now asserts pnpm keeps vite on the website app while other PMs must not. New monorepo.spec.ts covers pnpm vs npm/yarn/bun behavior; new-vite-monorepo snap expects vite: catalog: on the website.

Reviewed by Cursor Bugbot for commit 16f7d45. Configure here.

…tays effective

`vp create vite:monorepo` stripped vite/vitest from apps/website for every
package manager. For pnpm this removed the only direct `vite` dependency, so
the pnpm-workspace.yaml `overrides.vite: catalog:` entry had no consumer and
`vp why vite` resolved to upstream vite instead of @voidzero-dev/vite-plus-core,
making the override look ineffective.

Skip the strip for pnpm so the workspace override has a direct consumer. npm,
yarn, and bun are unaffected: their root overrides/resolutions redirect the
transitive/peer vite to @voidzero-dev/vite-plus-core regardless of a direct
dep (verified), so they keep dropping the dead-weight keys.
@fengmk2 fengmk2 self-assigned this Jun 1, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 1, 2026

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit 45dfe4c
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a1d297f7b986f0008157df5

…ompt

The migration prompt told agents to "remove old vite and vitest
dependencies" after rewriting imports. On pnpm that direct (aliased)
entry is what gives the pnpm-workspace.yaml `overrides.vite: catalog:`
a consumer to redirect, so removing it makes `vp why vite` report
upstream vite and the override look ineffective.

Reword the prompt (in both docs/guide/migrate.md and the CLI-printed
copy) to keep the aliased entries on pnpm; other package managers can
still drop them once import rewrites are confirmed. Regenerate the two
migration snap tests that capture the printed prompt.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

✅ Staging deployment successful!

Preview: https://viteplus-staging.void.app/
Commit: 45dfe4c

@fengmk2
Copy link
Copy Markdown
Member Author

fengmk2 commented Jun 1, 2026

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 16f7d45. Configure here.

@fengmk2 fengmk2 marked this pull request as ready for review June 1, 2026 02:57
@fengmk2 fengmk2 requested a review from cpojer June 1, 2026 02:57
@fengmk2 fengmk2 merged commit adf79db into main Jun 1, 2026
56 checks passed
@fengmk2 fengmk2 deleted the fix/create-pnpm-monorepo-vite-override branch June 1, 2026 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants