Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#3,281 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@voidzero-bot đang làm issue này rồi.

Từ ngày 29/10/2026.

  • #3282 của @voidzero-bot — đang mở

Đá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ả

- 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
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

Mở trong Codespaces

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.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của voidzero-dev/vite-plus

Tất cả issue của voidzero-dev/vite-plus

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.