Skip to content

Commit 670c987

Browse files
committed
docs(migrate): clarify pnpm vite dependency rule
1 parent 018f48c commit 670c987

2 files changed

Lines changed: 24 additions & 19 deletions

File tree

docs/guide/migrate-rules.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,30 @@ another diff.
3636

3737
## Dependency Changes
3838

39-
| Dependency | Migration rule |
40-
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
41-
| `vite-plus` | Add it where the package is migrated. Re-pin plain ranges to the current concrete target, directly or through a catalog. Preserve deliberate protocol pins. |
42-
| `vite` | Keep or add a real dependency edge where peer resolution requires one, and rewrite that edge plus the shared override/resolution to the matching `@voidzero-dev/vite-plus-core` target. An override rewrites an edge; it does not create one. |
43-
| `vitest` | Remove it in the common node-mode case because `vite-plus` provides it transitively. Keep or add an exact bundled version only in packages with direct Vitest requirements. |
44-
| `@vitest/*` | Align lockstep packages that the project directly lists to the bundled Vitest version. Prefer the package's existing catalog reference when its catalog owns that package; otherwise write the concrete version. |
45-
| `@voidzero-dev/vite-plus-test` | Remove all dependency, override, resolution, and catalog aliases. Rewrite imports to the current `vite-plus/test*` surface. |
39+
| Dependency | Migration rule |
40+
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
41+
| `vite-plus` | Add it where the package is migrated. Re-pin plain ranges to the current concrete target, directly or through a catalog. Preserve deliberate protocol pins. |
42+
| `vite` | Keep existing declarations. With pnpm, add a direct dev dependency to every package that depends on `vite-plus` and does not already declare `vite`. Point managed edges and the shared override to the matching `@voidzero-dev/vite-plus-core` target. |
43+
| `vitest` | Remove it in the common node-mode case because `vite-plus` provides it transitively. Keep or add an exact bundled version only in packages with direct Vitest requirements. |
44+
| `@vitest/*` | Align lockstep packages that the project directly lists to the bundled Vitest version. Prefer the package's existing catalog reference when its catalog owns that package; otherwise write the concrete version. |
45+
| `@voidzero-dev/vite-plus-test` | Remove all dependency, override, resolution, and catalog aliases. Rewrite imports to the current `vite-plus/test*` surface. |
4646

4747
### Vite and Overrides
4848

49-
Package-manager overrides do not synthesize dependency edges. This matters most
50-
with pnpm: Vitest has a required `vite` peer, and pnpm can auto-install upstream
51-
Vite when a package that depends on `vite-plus` has no direct `vite` edge. That
52-
creates separate Vite+, Vite, and Vitest peer contexts. Each affected pnpm
53-
workspace package must therefore declare `vite`; the workspace override then
54-
redirects that edge to Vite+ core.
49+
Package-manager overrides do not synthesize dependency edges. Under pnpm, every
50+
package that lists `vite-plus` in `dependencies` or `devDependencies` must also
51+
declare `vite`, unless it already has a `vite` entry in `dependencies`,
52+
`devDependencies`, `optionalDependencies`, or `peerDependencies`. Otherwise,
53+
pnpm can auto-install upstream Vite to satisfy Vitest's required `vite` peer,
54+
creating separate Vite+, Vite, and Vitest instances. `vp migrate` adds a missing
55+
`vite` entry to `devDependencies`; the workspace override redirects it to Vite+
56+
core.
5557

5658
Do not remove a direct `vite` declaration merely because a root override exists.
5759
Normalize existing plain or stale aliases while retaining named catalog
58-
references. A real edge is also required for Bun's peer resolver, and npm
59-
browser-provider layouts may need a top-level edge so nested Vitest packages can
60-
resolve `vite`. After migration, pnpm users should verify that each affected
61-
workspace package has the required direct edge.
60+
references. The general rule above is specific to pnpm. Bun mirrors its core
61+
alias as a direct dependency for its peer resolver, while npm browser-provider
62+
layouts may need a top-level edge so nested Vitest packages can resolve `vite`.
6263

6364
### When Vitest Is Directly Required
6465

@@ -154,8 +155,9 @@ lint autofix preserves these imports.
154155
11 no longer reads the legacy package.json settings.
155156
- Migration keeps dependency references, default and named catalogs, overrides,
156157
and `peerDependencyRules` consistent.
157-
- Each package whose `vite-plus`/Vitest peer context would otherwise install
158-
upstream Vite needs a direct `vite` edge.
158+
- Each package that lists `vite-plus` in `dependencies` or `devDependencies`
159+
gets a direct `vite` dev dependency unless it already declares `vite` in a
160+
dependency field.
159161
- Unrelated selector-shaped and object-valued overrides are preserved.
160162

161163
### npm

docs/guide/migrate.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ The `migrate` command is designed to move existing projects onto Vite+ quickly.
4949
- Can set up commit hooks
5050
- Can write agent and editor configuration files
5151

52+
See [Migration Rules](./migrate-rules.md) for the exact dependency, source
53+
rewrite, and package-manager behavior.
54+
5255
Most projects will require further manual adjustments after running `vp migrate`.
5356

5457
## Recommended Workflow

0 commit comments

Comments
 (0)