cf build/dev --mode fails for TanStack Start even though the detected command is vite build/dev (1.0.0-beta.28)
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
- 78/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ệ
- typescript, vite
- Lĩnh vực
- cli
Hướng nghiên cứu
Bắt đầu bằng cách tìm lớp framework TanStack Start trong autoconfig được đóng gói và so sánh thiết lập supportsMode của lớp này với các lớp Vite và Astro; lần theo bước kiểm tra cf build được mô tả trong issue. Xác nhận hành vi bằng ví dụ tái hiện được cung cấp với cf build --mode production và cf dev --mode production; hoàn tất khi cả hai đều chấp nhận --mode cho TanStack Start.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happened
In a TanStack Start project, cf build --mode <name> and cf dev --mode <name> both fail before anything runs:
$ cf build --mode production
┌ Error
│ The detected command `bunx vite build` does not currently support `--mode`.
└
$ cf dev --mode production
┌ Error
│ The detected command `bunx vite dev` does not currently support `--mode`.
└
(With npm the command is shown as npx vite build.)
The detected command is plain vite build / vite dev, and Vite accepts --mode. The same project without @tanstack/react-start installed works: cf build --mode production delegates to vite build "--mode" "production" and succeeds.
Minimal reproduction
mkdir cf-mode-repro && cd cf-mode-repro
cat > package.json <<'JSON'
{ "name": "cf-mode-repro", "private": true, "type": "module",
"devDependencies": { "vite": "8.3.6", "@cloudflare/vite-plugin": "2.0.0-beta.v.12", "cf": "1.0.0-beta.28" } }
JSON
cat > vite.config.ts <<'TS'
import { defineConfig } from "vite";
import { cloudflare } from "@cloudflare/vite-plugin";
export default defineConfig({ plugins: [cloudflare()] });
TS
mkdir src && echo 'export default { fetch() { return new Response("ok") } }' > src/index.ts
cat > cloudflare.config.ts <<'TS'
import { defineConfig } from "cf/config";
export default defineConfig({ worker: { name: "cf-mode-repro", entrypoint: "./src/index.ts", compatibilityDate: "2026-11-01" } });
TS
bun install
cf build --mode production # works: "Delegating to bunx vite build "--mode" "production""
bun add -d @tanstack/[email protected] react@19 react-dom@19
cf build --mode production # fails: "does not currently support `--mode`"
cf dev --mode production # fails the same way
Likely cause
In the bundled autoconfig, the Vite and Astro framework classes set supportsMode = true, but the TanStack Start class extends the base Framework class (supportsMode = false). Its configuration still reports buildTool: "vite", and the build and dev commands are <pm> vite build / <pm> vite dev. cf build then throws on if (buildCommand && mode && !framework.supportsMode).
Setting supportsMode = true for TanStack Start (or deriving it from buildTool === "vite") should fix it.
Why it matters
defineConfig(({ mode }) => …) can't branch on mode for TanStack Start projects through cf. That rules out a staging or preview Worker. Our workaround is to call vite build --mode <name> directly and skip cf build.
Environment
cf1.0.0-beta.28,@cloudflare/vite-plugin2.0.0-beta.v.12,@tanstack/react-start1.169.4, Vite 8.3.6- macOS (arm64), Node 26.13, Bun 1.4.4. Also reproduced with npm (no lockfile, monorepo workspace).
Related
#45 covers the same error for Nuxt and Next.js, which don't build through Vite. This one is narrower: TanStack Start already builds through vite, so only the supportsMode flag is missing.
- Ngôn ngữ chính
- TypeScript
- Star
- 993
- Fork
- 65
- Merge trung bình
- 21 giờ 51 phút
- Pull request đã merge (30 ngày)
- 209
Chuẩn bị môi trường
- Không có Dockerfile hay 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 cloudflare/cf
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
cloudflare/cf#344 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
upstream
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
cloudflare/cf#262 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`cf dev` rejects `--port` and `--host` for Vite projects, including the `cf init` templateCó thể đã có người làm @jamesopstad đã nhận 26 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
cloudflare/cf#223 · 2 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
upstream
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
cloudflare/cf#179 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`cf migrate` fails with `ERR_PNPM_IGNORED_BUILDS` in a pnpm workspace that has not approved workerdĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
cloudflare/cf#511 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của cloudflare/cf
Issue tương tự
-
status: needs triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
mastra-ai/mastra#29706 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
lingdojo/kana-dojo#33802 · 1 bình luận · 5 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
cloudflare/workerd#8290 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: build-and-ci possible-duplicate S3: minor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
manaflow-ai/cmux#38889 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
ValentinH/react-easy-crop#670 ·