vp run ignores `cd` before a nested `vpr` in a script and runs the parent package's task
维护者通常 1 天内回复
评估
调研方向
Start by tracing how vp run handles nested vpr commands and resolves their tasks; the issue provides a minimal reproduction with root and ui package scripts. Run the reproduction and compare vpr plain with vpr sub to confirm the working-directory behavior. Done when cd ui && vpr hello inside a script runs the ui package's task.
由索引模型根据 Issue 内容生成。
描述
Describe the bug
If a package.json script does cd <dir> && vpr <task>, vp run ignores the cd. It looks up <task> in the package it started from instead of the one in <dir>. Putting the same command in a subshell, (cd <dir> && vpr <task>), gives the right result.
The log shows vp run running the nested vpr itself rather than handing the whole line to the shell. For plain it prints $ echo ROOT, which is the root's hello.
This happens without any pnpm workspace. The repro has no pnpm-workspace.yaml and no lockfile, so it's a different bug from #3013, though the symptom is the same: vpr in a subfolder runs the root's task.
Reproduction
mkdir repro && cd repro && mkdir ui
echo '{"name":"root","private":true,"scripts":{"hello":"echo ROOT","plain":"cd ui && vpr hello","sub":"(cd ui && vpr hello)"}}' > package.json
echo '{"name":"ui","private":true,"scripts":{"hello":"echo UI"}}' > ui/package.json
vpr plain # prints ROOT, expected UI
vpr sub # prints UI
(cd ui && vpr hello) # from the shell: prints UI
Output:
$ vpr plain
$ echo ROOT ⊘ cache disabled
ROOT
$ vpr sub
$ (cd ui && vpr hello) ⊘ cache disabled
$ echo UI ⊘ cache disabled
UI
Expected
cd ui && vpr hello should run ui's hello, the same as it does in a shell or under npm run. If vp run handles a nested vpr itself, it should apply any earlier cd in the same command before it resolves the task.
Environment
- vp v1.1.0 (global, no local vite-plus)
- Node v24.19.0
- Linux
Written by claude-opus-5-5 via Claude Code in T3 Code on goobles-agentbox.
- 主要语言
- Rust
- 星标
- 6.3k
- 派生
- 283
- 平均合并
- 1 天 16 小时
- 30 天内合并 PR
- 214
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
voidzero-dev/vite-plus 的其他 Issue
-
pending triage
难度 2/5 1-3 小时 新手友好度 72/100
voidzero-dev/vite-plus#2882 · 2 条评论 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 62/100
voidzero-dev/vite-plus#2097 · 10 条评论 · 2 个 reaction ·
维护者通常 1 天内回复
-
defineConfig drops own properties of Promise plugins (breaks Vike discovery)可能已有人在做 @liangmiQwQ 今天认领。 未关闭bug
voidzero-dev/vite-plus#3152 · 已指派 1 人 ·
维护者通常 1 天内回复
-
vpx: watch reports for `vpx --watch`, and `vpx watch` on oxc-node's watcher可能已有人在做 @fengmk2 于 1 天前认领。 未关闭
voidzero-dev/vite-plus#3141 · 1 个 reaction · 已指派 1 人 ·
维护者通常 1 天内回复
-
Document cross-platform `FOO=bar cmd` in task commands and scripts可能已有人在做 @hyunbinseo 于 1 天前认领。 未关闭documentation
voidzero-dev/vite-plus#3140 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 voidzero-dev/vite-plus 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 66/100
-
Negative subscript on a sparse array counts from the number of elements, not from the highest index未关闭area: compat bug
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
longbridge/gpui-kit#3620 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 69/100
mongodb/kingfisher#564 ·
维护者通常 1 天内回复