cf build/dev --mode fails for TanStack Start even though the detected command is vite build/dev (1.0.0-beta.28)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript, vite
- 領域
- cli
調査の方向性
まず、バンドルされた autoconfig 内の TanStack Start のフレームワーククラスを見つけ、その supportsMode 設定を Vite と Astro のクラスと比較します。issue に記載された cf build のチェックを追います。提供された再現手順で cf build --mode production と cf dev --mode production を実行して動作を確認します。TanStack Start で両方が --mode を受け付ければ完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 993
- フォーク
- 65
- 平均マージ
- 21時間 51分
- マージ済み PR(30日)
- 209
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
cloudflare/cf のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
cloudflare/cf#344 ·
メンテナーはふだん 1 日以内に返信
-
upstream
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
cloudflare/cf#262 ·
メンテナーはふだん 1 日以内に返信
-
`cf dev` rejects `--port` and `--host` for Vite projects, including the `cf init` template対応中かも @jamesopstad が 26 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
cloudflare/cf#223 · 担当者 2 名 ·
メンテナーはふだん 1 日以内に返信
-
upstream
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
cloudflare/cf#179 ·
メンテナーはふだん 1 日以内に返信
-
`cf migrate` fails with `ERR_PNPM_IGNORED_BUILDS` in a pnpm workspace that has not approved workerdオープン
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
cloudflare/cf#511 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
Waiting for: Product Owner
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
getsentry/sentry-javascript#26203 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
bytedance/flowgram.ai#1235 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
devswha/herdr-web-ui#3325 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100