defineConfig always injects vite-plus:vitest-resolver into vp build / vp dev even when Vitest isn't used
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- bun, typescript
- Ambito
- build-system, tooling
Direzione di ricerca
Riproduci il problema con un vite.config.ts che importa defineConfig da vite-plus ed esegui vp build con i tempi dei plugin abilitati. Leggi le modifiche al resolver e all’auto-inline matcher nelle PR 356 e 1113, quindi traccia come vp build, vp dev e vp test li iniettano; il lavoro è completato quando i comandi non di test non comportano più plugin esclusivi di Vitest oppure esiste un’opzione di esclusione documentata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
defineConfig from vite-plus always prepends Vitest-only plugins into every Vite config, including for vp build / vp dev:
vite-plus:vitest-resolvervite-plus:auto-inline-matchervite-plus:coverage-version-guard
Projects that use Vite+ for toolchain (fmt / lint / build) but run tests with another runner (e.g. Bun's bun:test) still pay for these plugins on every production build.
Rolldown/Vite plugin timings report:
[PLUGIN_TIMINGS] Your build spent significant time in plugins. Here is a breakdown:
- vite-plus:vitest-resolver (87%)
The resolver is an enforce: "pre" resolveId hook, so it runs on every module resolve. It early-returns for non-vitest / @vitest/* ids, but with a large graph that still dominates plugin time.
There is no documented opt-out. lazyPlugins only gates user plugins during config-metadata loads; it does not skip these injected plugins on build/dev. vite-plus/prefer-vite-plus-imports also pushes app configs to import defineConfig from vite-plus rather than vite, so switching away isn't a clean escape hatch.
Reproduction
- Use
import { defineConfig } from "vite-plus"in an appvite.config.ts - Do not configure or run
vp test/ Vitest - Run
vp build(with plugin timings enabled) - Observe
vite-plus:vitest-resolvernear the top of[PLUGIN_TIMINGS]
Expected
Vitest helper plugins should only be injected when running tests (vp test / Vitest), or there should be an explicit opt-out for projects that don't use Vitest.
System Info
vite-plus:0.2.5- Tests: Bun (
bun:test), not Vitest - Apps build via
vp build
Suggested fix
- Gate injection on test command / presence of
testconfig, or - Add a config flag such as
test: false/vitest: falseto skip injection, or - Document a supported way to opt out without fighting
prefer-vite-plus-imports
Related
- Implementation that introduced/patched the resolver: https://github.com/voidzero-dev/vite-plus/pull/356
- Auto-inline matcher: https://github.com/voidzero-dev/vite-plus/pull/1113
lazyPlugins(user plugins only): https://github.com/voidzero-dev/vite-plus/pull/1215
- Lingua principale
- Rust
- Stelle
- 5.8k
- Fork
- 263
- Merge medio
- 1g 3h
- PR unite (30g)
- 147
Guida per i contributori
Apri 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
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
voidzero-dev/vite-plus#2804 · 1 reazione ·
-
pending triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
voidzero-dev/vite-plus#2801 · 1 reazione ·
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
voidzero-dev/vite-plus#2097 · 10 commenti · 2 reazioni ·
-
documentation
voidzero-dev/vite-plus#2800 · 1 assegnatario ·
-
pending triage
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
voidzero-dev/vite-plus#2796 · 1 commento ·
Tutte le issue di voidzero-dev/vite-plus
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
TheLarkInn/aipm#2413 ·
-
documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
alexgorbatchev/simple-ptt#15 ·
-
tooling
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
todo:ticket
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
taikoxyz/taiko-mono#22168 · 1 commento ·