[plugin-rsc] vite build --watch exits 1 with ENOENT before the first build is written
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 42/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- node.js, react, typescript, vite
- 领域
- build-system, tooling
调研方向
Start in packages/plugin-rsc/src/plugin.ts around the buildApp calls (the issue points at L496-L505 and L524) and read how the builder's return value is used: under build.watch the promise resolves with a watcher, not finished output, so the subsequent rename and manifest write race the first build. Reproduce first with the linked repro repo (npm run repro vs npm run control) across both output layouts. Done means vite build --watch produces the same files as vite build and keeps watching; a regression test in the plugin's test suite should cover both layouts.
由索引模型根据 Issue 内容生成。
描述
Written with the help of an AI coding agent (Claude); reproduced locally.
Related plugins
Describe the bug
vite build --watch with plugin-rsc exits 1 on the first build and writes no server entry. vite build with the same config works.
Default output layout:
[5/5] build ssr environment...
vite v8.3.8 building ssr environment for production...
watching for file changes...
error during build:
Error: ENOENT: no such file or directory, open '<root>/dist/ssr/__vite_rsc_assets_manifest.js'
at RscPluginManager.writeAssetsManifest (.../@vitejs/plugin-rsc/dist/plugin-Ct0hu_Ip.js:626:7)
at buildApp (.../@vitejs/plugin-rsc/dist/plugin-Ct0hu_Ip.js:741:11)
With the RSC output inside the SSR output (rsc: dist/server/rsc, ssr: dist/server) it fails at step 3:
[3/5] build rsc environment...
vite v8.3.8 building rsc environment for production...
watching for file changes...
error during build:
Error: ENOENT: no such file or directory, rename '<root>/dist/server/rsc' -> '<root>/node_modules/.vite-rsc-temp/rsc'
at buildApp (.../@vitejs/plugin-rsc/dist/plugin-Ct0hu_Ip.js:729:7)
Under build.watch, builder.build() resolves with the watcher before the output is written, and buildApp moves or writes into it right away:
https://github.com/vitejs/vite-plugin-react/blob/447ab6208f5fd85968e8307735e1198ea17148c2/packages/plugin-rsc/src/plugin.ts#L496-L505
(and L524 for the manifest).
Reproduction
https://github.com/Sheraff/vite-plugin-rsc-build-watch-repro
Steps to reproduce
npm install
npm run repro # vite build --watch on both layouts
npm run control # vite build on both layouts
Actual:
$ npm run repro
BUG default layout exit 1
missing: dist/rsc/index.js, dist/ssr/index.js
Error: ENOENT: no such file or directory, open 'dist/ssr/__vite_rsc_assets_manifest.js'
BUG rsc inside ssr exit 1
missing: dist/server/rsc/index.js, dist/server/index.js
Error: ENOENT: no such file or directory, rename 'dist/server/rsc' -> 'node_modules/.vite-rsc-temp/rsc'
$ npm run control
OK default layout exit 0
OK rsc inside ssr exit 0
Expected: vite build --watch writes the same output as vite build and keeps watching.
Same result on vite 8.3.4, 8.4.0-beta.1 and 7.3.8, and with the pkg.pr.new build of main (447ab62).
System Info
System:
OS: Linux 6.12 Debian GNU/Linux 13 (trixie) 13 (trixie)
CPU: (32) x64 AMD Ryzen 9 9955HX 16-Core Processor
Memory: 53.06 GB / 60.50 GB
Container: Yes
Shell: 5.2.37 - /bin/bash
Binaries:
Node: 26.12.1 - ~/.local/share/pnpm/bin/node
npm: 12.2.0 - ~/.local/share/pnpm/bin/npm
pnpm: 12.11.2 - ~/.local/share/pnpm/bin/pnpm
Browsers:
Chrome: 158.0.8127.36
npmPackages:
@vitejs/plugin-rsc: 0.5.39 => 0.5.39
react: 19.3.1 => 19.3.1
react-dom: 19.3.1 => 19.3.1
vite: 8.3.8 => 8.3.8
Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
- 主要语言
- TypeScript
- 星标
- 1.2k
- 派生
- 287
- 平均合并
- 1 天 17 小时
- 30 天内合并 PR
- 19
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
vitejs/vite-plugin-react 的其他 Issue
-
plugin-rsc: a client reference's CSS is linked before the CSS of the chunks it imports (build)可能已有人在做 @wozhenbang2004 于 6 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
vitejs/vite-plugin-react#1570 ·
维护者通常 1 天内回复
-
pending triage
难度 4/5 3-5 天 新手友好度 35/100
vitejs/vite-plugin-react#1581 ·
维护者通常 1 天内回复
-
[plugin-rsc] Build exits 0, but the app fails at runtime: a server action imported only by browser code is missing from the RSC build可能已有人在做 @NeilPant 于 3 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 48/100
vitejs/vite-plugin-react#1578 ·
维护者通常 1 天内回复
-
[plugin-rsc] inline "use server" function declarations lose hoisting and throw TDZ ReferenceError可能已有人在做 @draarivpatel-ui 于 2 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 55/100
vitejs/vite-plugin-react#1566 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 45/100
vitejs/vite-plugin-react#1565 · 2 条评论 ·
维护者通常 1 天内回复
查看 vitejs/vite-plugin-react 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 67/100
knaw-huc/textannoviz#742 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
cloudflare/realtimekit-ui#219 ·
维护者通常 1 天内回复
-
ui
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
tui: Mermaid renderer displays <b>/<strong> tags literally and ignores \n line breaks可能已有人在做 @argszero 今天认领。 未关闭area/tui platform/wsl status/repro-simulated type/bug version/v2
难度 2/5 1-3 小时 新手友好度 82/100
anomalyco/opencode#66773 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
mermaid-js/mermaid-v13#1370 ·
维护者通常 1 天内回复