`vp create` doesn't rewrite `vite` imports when adding a third-party template to a monorepo
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- typescript, vite
- Lĩnh vực
- tooling
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Rust
- Star
- 6.5k
- Fork
- 296
- Merge trung bình
- 1 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 230
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của voidzero-dev/vite-plus
-
pending triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
voidzero-dev/vite-plus#3235 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Docker guide: the runtime stage needs libatomic1 for Node.js 25 and laterCó thể đã có người làm @kshanxs đã nhận 5 ngày trước. Đang mởdocumentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
voidzero-dev/vite-plus#3219 · 2 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
pending triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
voidzero-dev/vite-plus#2882 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`npm install -g` keeps the `bin` link on the old version after the default Node.js changesCó thể đã có người làm @mondaychen đã nhận hôm nay. Đang mởbug triage: failed
voidzero-dev/vite-plus#3279 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
☂️ Plan for 2026 Q4Đang mởtriage: not actionable
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
voidzero-dev/vite-plus#3277 · 1 bình luận · 3 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của voidzero-dev/vite-plus
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
o8 next debug build aborts on Glass to Dark appearance switch (nil identifier messaged before check)Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
hurttlocker/o8#5112 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
memory_patch_page drops the `#` of headings like `## Notes on C#`Có thể đã có người làm @viniciusdsandrade đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
akitaonrails/ai-memory#1859 ·
Maintainer thường phản hồi trong vòng 1 ngày