apps/web preview overwrites newly built dist/index.html with stale dist/index.html.bak across builds
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- node.js, typescript, vite
- Domain
- build-system, tooling
Research direction
Start with apps/web/package.json:8 (build) and apps/web/package.json:11 (preview), then apps/web/vite.config.ts:43 where emptyOutDir: false is set; compare the build scripts of apps/api/package.json and apps/gateway/package.json for the cleaning pattern. Note turbo.json:11 caches dist/**, which is why the stale .bak survives. Done when a second pnpm test:e2e after a code change serves the newly emitted hashed chunks, verified by inspecting the <script> tags in apps/web/dist/index.html.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- TypeScript
- Stars
- 119
- Forks
- 19
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 60
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DouglasNeuroInformatics/OpenDataCapture
-
A docs change can fail pnpm check, because outreach lint and gen:types both write .astro/ at oncePossibly taken @2389400626lh-ops claimed this today. OpenArea: Infrastructure Area: Outreach Bug Difficulty: Low Good First Issue Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
DouglasNeuroInformatics/OpenDataCapture#1956 ·
Maintainers usually reply within 1 day
-
Area: Infrastructure Chore Difficulty: Low Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
DouglasNeuroInformatics/OpenDataCapture#1948 ·
Maintainers usually reply within 1 day
-
Area: API Bug Difficulty: Low Priority: Low
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
DouglasNeuroInformatics/OpenDataCapture#1937 ·
Maintainers usually reply within 1 day
-
Area: Infrastructure Bug Difficulty: Low Priority: Medium Security
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
DouglasNeuroInformatics/OpenDataCapture#1916 ·
Maintainers usually reply within 1 day
-
Area: Infrastructure Chore Difficulty: Low Priority: Medium
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
DouglasNeuroInformatics/OpenDataCapture#1835 ·
Maintainers usually reply within 1 day
All issues in DouglasNeuroInformatics/OpenDataCapture
Similar issues
-
prio:low status:done type:content
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
davidsneighbour/samui-samui.de#1925 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
opensro-dev/opensro#4901 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
super-productivity/super-productivity#12128 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
danielmiessler/LifeOS#3047 ·
Maintainers usually reply within 5 days
-
[Bug]: 64-tool catalog advisory counts the whole searchable catalog under Code Mode / Tool SearchOpenclawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro issue-rating: 🦞 diamond lobster P3
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
openclaw/openclaw#208678 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day