Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

`vp create` doesn't rewrite `vite` imports when adding a third-party template to a monorepo

Aperta
#3,281 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@voidzero-bot ci sta già lavorando.

Dal 29/10/2026.

  • #3282 di @voidzero-bot — aperta

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

- P2: has workaround pending triage triage: fix verified
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
Lingua principale
Rust
Stelle
6.5k
Fork
296
Merge medio
1g 2h
PR unite (30g)
230

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di voidzero-dev/vite-plus

Tutte le issue di voidzero-dev/vite-plus

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.