Skip to content

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

Open

Description

@risnake

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions