`vp create` doesn't rewrite `vite` imports when adding a third-party template to a monorepo
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Estagnada
- Stack de tecnologia
- typescript, vite
- Domínio
- tooling
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Rust
- Estrelas
- 6.5k
- Forks
- 296
- Merge médio
- 1d 2h
- PRs com merge (30d)
- 230
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de voidzero-dev/vite-plus
-
pending triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 63/100
voidzero-dev/vite-plus#3235 ·
Mantenedores costumam responder em até 1 dia
-
Docker guide: the runtime stage needs libatomic1 for Node.js 25 and laterTalvez já em andamento @kshanxs assumiu há 5 dias. Abertadocumentation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
voidzero-dev/vite-plus#3219 · 2 comentários · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
pending triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
voidzero-dev/vite-plus#2882 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
`npm install -g` keeps the `bin` link on the old version after the default Node.js changesTalvez já em andamento @mondaychen assumiu hoje. Abertabug triage: failed
voidzero-dev/vite-plus#3279 · 1 comentário · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
☂️ Plan for 2026 Q4Abertatriage: not actionable
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 15/100
voidzero-dev/vite-plus#3277 · 1 comentário · 3 reações ·
Mantenedores costumam responder em até 1 dia
Todas as issues de voidzero-dev/vite-plus
Issues semelhantes
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
Mantenedores costumam responder em até 1 dia
-
o8 next debug build aborts on Glass to Dark appearance switch (nil identifier messaged before check)Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
hurttlocker/o8#5112 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 79/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
memory_patch_page drops the `#` of headings like `## Notes on C#`Talvez já em andamento @viniciusdsandrade assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
akitaonrails/ai-memory#1859 ·
Mantenedores costumam responder em até 1 dia