Skip to content

feat(create-vite): support Vite+ (vp) package manager - #22788

Merged
sapphi-red merged 4 commits into
vitejs:mainfrom
fengmk2:feat/create-vite-vp-support
Nov 13, 2026
Merged

sapphi-red merged 4 commits into
vitejs:mainfrom
fengmk2:feat/create-vite-vp-support

Conversation

@fengmk2

@fengmk2 fengmk2 commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Description

When create-vite runs through vp dlx create-vite (Vite+), it falls back to npm commands. The underlying package manager (pnpm/npm/yarn/bun) overwrites npm_config_user_agent, so create-vite cannot see that vp started it.

Since vite-plus v1.6.0 (voidzero-dev/vite-plus#1958), vp, vpr, and vpx set VP_USER_AGENT=vp/<version> for child processes. This PR teaches create-vite to read it:

  • Detect Vite+ from VP_USER_AGENT. When it is unset or empty, use npm_config_user_agent as before.
  • The done message and --immediate use vp install and vp run dev.
  • getFullCustomCommand maps npm create to vp dlx create- and npm exec to vp dlx, the same shape as the bun/pnpm/deno branches.
Template Command with Vite+
custom-create-vue vp dlx create-vue@latest TARGET_DIR
custom-vike-vue vp dlx create-vike@latest --vue TARGET_DIR
custom-nuxt vp dlx nuxi init TARGET_DIR
ember-app vp dlx ember-cli@latest new TARGET_DIR

Why vp run dev and not vp dev

vp dev is a Vite+ built-in command. It starts the Vite+ dev server and ignores the dev script in package.json. A scaffolded project has no local vite-plus, so vp dev uses the Vite that the global Vite+ toolchain bundles (vite@8.3.7 in vite-plus 1.6.0), not the vite that the project installs (vite@8.3.8 today). vp run dev runs the dev script with the installed vite, the same as npm run dev.

Why vp dlx create- and not vp create

npm create X is defined as npm exec create-X, and vp dlx create-X is the structural equivalent (dlx = exec). It passes all positionals and flags to the create-* binary. vp create consumes the target-dir positional itself (it uses its own --directory flag), so the TARGET_DIR convention breaks. The npm create -- vike@latest --vue TARGET_DIR templates also need their flags after a -- separator that a prefix-only replacement cannot produce. vp create is also an opinionated flow (agent/editor/git/hooks setup), not a transparent passthrough.

🤖 Generated with Claude Code

@fengmk2

This comment was marked as outdated.

@sapphi-red sapphi-red added p3-significant High priority enhancement (priority) feat: create-vite create-vite package labels Jun 30, 2026
fengmk2 added a commit to voidzero-dev/vite-plus that referenced this pull request Nov 10, 2026
Tools started by `vp` cannot reliably detect Vite+ because package
managers replace `npm_config_user_agent`.

The global and local `vp`, `vpr`, and `vpx` entry points now set
`VP_USER_AGENT=vp/<version>`. Each invocation reports its own version.
When the global CLI delegates to a local CLI, the local version takes
over. Ordinary tool shims preserve an inherited value without creating
one.

Child tools can read the first product token to detect Vite+ and allow
for future fields. The value identifies the CLI; it does not include
command names or arguments.

Companion change: vitejs/vite#22788.
fengmk2 and others added 2 commits November 13, 2026 00:20
Detect Vite+ from the `VP_USER_AGENT` env var that `vp` sets (the underlying
package manager overwrites `npm_config_user_agent`), and emit vp commands:
`vp install`, `vp dev`, and `vp dlx` for template custom commands.
`vp dev` starts the Vite+ built-in dev server and ignores the project's
`dev` script. In a project without a local `vite-plus`, it also uses the
Vite that the global Vite+ toolchain bundles, not the installed `vite`.
Use `vp run dev` so the `dev` script runs, like `npm run dev`.

Also fall back to `npm_config_user_agent` when `VP_USER_AGENT` is empty,
and let the test helper pass env overrides again after the move to
`tinyexec`, so the Vite+ test sets `VP_USER_AGENT`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fengmk2
fengmk2 force-pushed the feat/create-vite-vp-support branch from 81caa05 to 6efb33d Compare November 12, 2026 16:41
@fengmk2
fengmk2 marked this pull request as ready for review November 12, 2026 16:48
@fengmk2

fengmk2 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

@sapphi-red ready now!

@sapphi-red sapphi-red added this to the 8.4 milestone Nov 13, 2026
@sapphi-red
sapphi-red merged commit 4d21dc4 into vitejs:main Nov 13, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat: create-vite create-vite package p3-significant High priority enhancement (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants