apps/web preview overwrites newly built dist/index.html with stale dist/index.html.bak across builds
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 82/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- node.js, typescript, vite
- 领域
- build-system, tooling
调研方向
从 apps/web/package.json:8(build)和 apps/web/package.json:11(preview)开始,然后查看 apps/web/vite.config.ts:43,其中设置了 emptyOutDir: false;对比 apps/api/package.json 和 apps/gateway/package.json 的 build 脚本,寻找清理模式。注意 turbo.json:11 会缓存 dist/**,这就是过期的 .bak 得以保留的原因。完成标准是:代码变更后第二次运行 pnpm test:e2e 时,能提供新生成的带哈希的 chunks,并通过检查 <script> 标签(在 apps/web/dist/index.html 中)来验证。
由索引模型根据 Issue 内容生成。
描述
apps/web/vite.config.ts:43 sets build.emptyOutDir: false, and apps/web/package.json:8 ("build": "tsc && NODE_ENV=production NODE_OPTIONS='--import=tsx' pnpm exec vite build") does not remove dist before building.
When pnpm test:e2e starts apps/web's preview script (apps/web/package.json:11):
env-cmd -f ../../.env -- pnpm exec import-meta-env -x .env.public -p dist/index.html && NODE_OPTIONS='--import=tsx' env-cmd -f ../../.env pnpm exec vite preview
@import-meta-env/cli saves a backup of dist/index.html to dist/index.html.bak on the first run and, whenever dist/index.html.bak already exists, reads dist/index.html.bak as its template and overwrites dist/index.html with it.
Because vite build has emptyOutDir: false:
- Subsequent
pnpm buildruns write a newdist/index.htmland new content-hasheddist/assets/*.jschunks, while leaving the olddist/index.html.bakand olddist/assets/*.jsfiles inapps/web/dist/. - Turbo caches
dist/**(turbo.json:11), including the staledist/index.html.bak. - On the next
pnpm test:e2erun,import-meta-envoverwrites the newly builtdist/index.htmlwith the staledist/index.html.bak, sovite previewserves the old hashed JS chunks from an earlier build or branch instead of the currentapps/webcode.
Reproduction
- Run
pnpm test:e2e(which createsapps/web/dist/index.html.bakviapnpm preview). - Change code in
apps/web(or switch branches) and runpnpm test:e2eagain withoutrm -rf apps/web/dist. - Inspect
apps/web/dist/index.htmlafterpnpm previewstarts: its<script>and<link rel="modulepreload">tags matchapps/web/dist/index.html.bakfrom step 1 rather than the newly emitted chunks from step 2.
Possible fix
Clean dist before vite build in apps/web/package.json (matching apps/api/package.json and apps/gateway/package.json, or enable emptyOutDir: true if runtime plugin ordering allows it) or remove dist/index.html.bak during apps/web build.
- 主要语言
- TypeScript
- 星标
- 119
- 派生
- 19
- 平均合并
- 1 天 18 小时
- 30 天内合并 PR
- 60
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
DouglasNeuroInformatics/OpenDataCapture 的其他 Issue
-
A docs change can fail pnpm check, because outreach lint and gen:types both write .astro/ at once可能已有人在做 @2389400626lh-ops 今天认领。 未关闭Area: Infrastructure Area: Outreach Bug Difficulty: Low Good First Issue Priority: Low
难度 2/5 1-3 小时 新手友好度 78/100
DouglasNeuroInformatics/OpenDataCapture#1956 ·
维护者通常 1 天内回复
-
Area: Infrastructure Chore Difficulty: Low Priority: Low
难度 2/5 1-3 小时 新手友好度 72/100
DouglasNeuroInformatics/OpenDataCapture#1948 ·
维护者通常 1 天内回复
-
Area: API Bug Difficulty: Low Priority: Low
难度 2/5 1-3 小时 新手友好度 62/100
DouglasNeuroInformatics/OpenDataCapture#1937 ·
维护者通常 1 天内回复
-
Area: Infrastructure Bug Difficulty: Low Priority: Medium Security
难度 2/5 1-3 小时 新手友好度 72/100
DouglasNeuroInformatics/OpenDataCapture#1916 ·
维护者通常 1 天内回复
-
Area: Infrastructure Chore Difficulty: Low Priority: Medium
难度 2/5 1-3 小时 新手友好度 70/100
DouglasNeuroInformatics/OpenDataCapture#1835 ·
维护者通常 1 天内回复
查看 DouglasNeuroInformatics/OpenDataCapture 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
super-productivity/super-productivity#12128 · 2 条评论 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 77/100
维护者通常 1 天内回复
-
`getClientCredentialsToken()` sends `scopes` (comma-joined) instead of the OAuth `scope` parameter未关闭
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 1/5 1-3 小时 新手友好度 72/100
justyns/silverbullet-ai#199 ·
-
bug
难度 2/5 1-3 小时 新手友好度 83/100
spartan-ng/spartan#1931 ·
维护者通常 2 天内回复