`vp create` doesn't rewrite `vite` imports when adding a third-party template to a monorepo
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- typescript, vite
- Ambito
- tooling
Direzione di ricerca
Read packages/cli/src/migration/migrator/orchestrators.ts and the vp create path in packages/cli/src/create/bin.ts. Compare how rewriteStandaloneProject and rewriteMonorepoProject handle import rewriting and lazy plugin wrapping, then run the reproduction and vp check. Done when creating a package in a monorepo rewrites the vite import to vite-plus and the check passes; a linked pull request is already open.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
When vp create adds a third-party template to an existing Vite+ monorepo, the new package's
vite.config.ts keeps import { defineConfig } from "vite" while lazyPlugins is imported from
vite-plus, so vp check fails on vite-plus/prefer-vite-plus-imports. vp migrate rewrites this
import; vp create doesn't.
Expected: defineConfig is imported from vite-plus, as after vp migrate.
Actual (apps/web/vite.config.ts):
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";
import { lazyPlugins } from "vite-plus";
Not framework-specific: adding a React app the same way
(vp create vite --no-interactive -- react-app --template react-ts) gives
import { defineConfig } from "vite" + import { lazyPlugins } from "vite-plus" too.
Outside a monorepo, the same vp create [email protected] … command is correct
(import { defineConfig, lazyPlugins } from "vite-plus"), which points at the monorepo path.
Cause: rewriteMonorepoProject (packages/cli/src/migration/migrator/orchestrators.ts) never calls
rewriteAllImports. rewriteStandaloneProject does, and rewriteMonorepo runs it once for the whole
workspace (it calls rewriteMonorepoProject with deferLazyPluginWrapping = true). vp create adding a
package to a monorepo only calls rewriteMonorepoProject (create/bin.ts), which wraps lazy plugins
without having rewritten imports.
Suggested fix: in rewriteMonorepoProject, when deferLazyPluginWrapping is false, call
rewriteAllImports(projectPath, …) before wrapLazyPluginsInViteConfig, as rewriteStandaloneProject
does. Happy to send a PR if that helps.
Reproduction
https://github.com/DaniilKubarenko/vp-create-monorepo-vite-imports
Steps to reproduce
vp create vite:monorepo --no-interactive --directory repro --no-hooks --package-manager pnpm
cd repro
vp create [email protected] --no-interactive -- web --template minimal --types ts --no-add-ons
cd apps/web
vp check
The linked repo is the unmodified output of the first three commands; `apps/website` and
`packages/utils` are the monorepo template's samples and unrelated.
### System Info
```shell
Node.js:
Version 26.13.0
Source engines.node
Bin Path C:\Users\<user>\AppData\Local\vite-plus\data\js_runtime\node\26.13.0\node.exe
Installed true
Mode managed
Package Manager:
Name pnpm
Version 12.16.1
Source devEngines.packageManager
Installed true
Mode managed
vp v1.4.0
Local vite-plus:
vite-plus v1.4.0
Tools:
vite v8.3.5
rolldown v1.2.15
vitest v5.0.5
oxfmt v0.74.0
oxlint v1.89.0
oxlint-tsgolint v7.0.2004
tsdown v0.23.1
Used Package Manager
pnpm
Logs
x vite-plus(prefer-vite-plus-imports): Use 'vite-plus' instead of 'vite' in Vite+ projects.
,-[vite.config.ts:3:30]
2 | import { sveltekit } from "@sveltejs/kit/vite";
3 | import { defineConfig } from "vite";
: ^^^^^^
Validations
- Read the Contributing Guidelines.
- Check that there isn't already an issue for the same bug.
- Confirm this is a Vite+ issue and not an upstream issue (Vite, Vitest, tsdown, Rolldown, or Oxc).
- The provided reproduction is a minimal reproducible example.
- Lingua principale
- Rust
- Stelle
- 6.5k
- Fork
- 296
- Merge medio
- 1g 2h
- PR unite (30g)
- 230
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di voidzero-dev/vite-plus
-
pending triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
voidzero-dev/vite-plus#3235 ·
I maintainer di solito rispondono entro 1 giorno
-
Docker guide: the runtime stage needs libatomic1 for Node.js 25 and laterForse già presa @kshanxs l’ha presa 5 giorni fa. Apertadocumentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
voidzero-dev/vite-plus#3219 · 2 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
pending triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
voidzero-dev/vite-plus#2882 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
`npm install -g` keeps the `bin` link on the old version after the default Node.js changesForse già presa @mondaychen l’ha presa oggi. Apertabug triage: failed
voidzero-dev/vite-plus#3279 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
☂️ Plan for 2026 Q4Apertatriage: not actionable
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
voidzero-dev/vite-plus#3277 · 1 commento · 3 reazioni ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di voidzero-dev/vite-plus
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno
-
o8 next debug build aborts on Glass to Dark appearance switch (nil identifier messaged before check)Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
hurttlocker/o8#5112 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
memory_patch_page drops the `#` of headings like `## Notes on C#`Forse già presa @viniciusdsandrade l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
akitaonrails/ai-memory#1859 ·
I maintainer di solito rispondono entro 1 giorno