apps/web preview overwrites newly built dist/index.html with stale dist/index.html.bak across builds
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- node.js, typescript, vite
- Lĩnh vực
- build-system, tooling
Hướng nghiên cứu
Bắt đầu với apps/web/package.json:8 (build) và apps/web/package.json:11 (preview), sau đó là apps/web/vite.config.ts:43 nơi emptyOutDir: false được đặt; so sánh các script build của apps/api/package.json và apps/gateway/package.json để tìm mẫu dọn dẹp. Lưu ý rằng turbo.json:11 cache dist/**, đó là lý do file .bak cũ vẫn tồn tại. Hoàn tất khi lần chạy pnpm test:e2e thứ hai sau một thay đổi mã phục vụ các chunk đã băm mới được phát ra, được xác minh bằng cách kiểm tra các thẻ <script> trong apps/web/dist/index.html.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 119
- Fork
- 19
- Merge trung bình
- 1 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 60
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của DouglasNeuroInformatics/OpenDataCapture
-
A docs change can fail pnpm check, because outreach lint and gen:types both write .astro/ at onceCó thể đã có người làm @2389400626lh-ops đã nhận hôm nay. Đang mởArea: Infrastructure Area: Outreach Bug Difficulty: Low Good First Issue Priority: Low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
DouglasNeuroInformatics/OpenDataCapture#1956 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Area: Infrastructure Chore Difficulty: Low Priority: Low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
DouglasNeuroInformatics/OpenDataCapture#1948 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Area: API Bug Difficulty: Low Priority: Low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
DouglasNeuroInformatics/OpenDataCapture#1937 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Area: Infrastructure Bug Difficulty: Low Priority: Medium Security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
DouglasNeuroInformatics/OpenDataCapture#1916 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Area: Infrastructure Chore Difficulty: Low Priority: Medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
DouglasNeuroInformatics/OpenDataCapture#1835 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của DouglasNeuroInformatics/OpenDataCapture
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
super-productivity/super-productivity#12128 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 1 ngày
-
`getClientCredentialsToken()` sends `scopes` (comma-joined) instead of the OAuth `scope` parameterĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 72/100
justyns/silverbullet-ai#199 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
spartan-ng/spartan#1931 ·
Maintainer thường phản hồi trong vòng 2 ngày