`cf dev` rejects `--port` and `--host` for Vite projects, including the `cf init` template

オープン 初心者向け
#223 コメント 0 件 リアクション 0 件 担当者 2 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@jamesopstad がすでに取り組んでいます。

2026年10月13日 から。

  • #286 @petebacondarwin による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
node.js, typescript, vite
領域
cli, devtools

調査の方向性

検出されたコマンドに対する cf dev の引数転送ロジックから始め、Vite の --mode の処理を、拒否される --port および --host オプションの処理と比較します。この issue ではソースファイルやテストファイルは指定されていません。示されたコマンドを使って cf init の Vite テンプレートで再現し、--port と --host が Vite に渡されること、既存の転送も引き続き機能することを確認します。

索引モデルが issue の本文から書いたものです。

説明

Summary of the issue

In a project created by cf init (which uses the Vite plugin v2 beta), cf dev refuses --port and --host:

$ cf dev --port 8787
┌ Error
│ Arguments cannot currently be forwarded to the detected dev command `npx
│ vite`. Run that command directly with the required arguments.
└

--host 127.0.0.1 fails the same way. --mode production is forwarded (Delegating to npx vite "--mode" "production"), and #22 shows --port reaching the Wrangler delegate. So the default template is the one setup where you can't change the dev server's port or host through cf dev.

Running npx vite --port 8787 works, but it skips cf's detection and autoconfig and means a different command than the one cf init prints in its next steps.

Expected behaviour

cf dev --port <n> and cf dev --host <h> forward to Vite as --port/--host, as they already do for the Wrangler delegate and as --mode already does for Vite.

Version of cf used

1.0.0-beta.12

System information and package versions
System:
  OS: macOS 27.0
  CPU: (18) arm64 Apple M5 Pro
  Shell: 5.9 - /bin/zsh
Binaries:
  Node: 26.8.2
  npm: 11.19.1
npmPackages:
  @cloudflare/vite-plugin: beta => 2.0.0-beta.sha-52b0dc0e9
  cf: ^1.0.0-beta.12 => 1.0.0-beta.12
Reproduction (optional)
cf init demo --package-manager npm
cd demo
cf dev --port 8787      # error above
cf dev --host 127.0.0.1 # same error
cf dev --mode production  # forwarded and works
Relevant error logs (optional)

Related: #22 (--persist-to ignored, and arguments after -- dropped).

主要言語
TypeScript
スター
960
フォーク
62
平均マージ
19時間 17分
マージ済み PR(30日)
183

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

cloudflare/cf のほかの issue

cloudflare/cf の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。