Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

defineConfig always injects vite-plus:vitest-resolver into vp build / vp dev even when Vitest isn't used

未关闭
#2,307 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
bun, typescript

调研方向

使用一个从 vite-plus 导入 defineConfig 的 vite.config.ts 重现该问题,并在启用插件计时的情况下运行 vp build。阅读 PRs 356 和 1113 中 resolver 与 auto-inline matcher 的更改,然后追踪 vp build、vp dev 和 vp test 如何注入它们;完成的标准是非测试命令不再产生仅供 Vitest 使用的插件,或者有一个已记录的 opt-out 方式。

由索引模型根据 Issue 内容生成。

描述

pending triage
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-resolver
  • vite-plus:auto-inline-matcher
  • vite-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
  1. Use import { defineConfig } from "vite-plus" in an app vite.config.ts
  2. Do not configure or run vp test / Vitest
  3. Run vp build (with plugin timings enabled)
  4. Observe vite-plus:vitest-resolver near 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 test config, or
  • Add a config flag such as test: false / vitest: false to skip injection, or
  • Document a supported way to opt out without fighting prefer-vite-plus-imports
Related
主要语言
Rust
星标
6k
派生
274
平均合并
1 天 11 小时
30 天内合并 PR
203

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

voidzero-dev/vite-plus 的其他 Issue

查看 voidzero-dev/vite-plus 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。