Skip to content

[vite-plugin] Remove the cf-vite delegate - #16759

Draft
petebacondarwin wants to merge 1 commit into
mainfrom
codex/remove-cf-vite
Draft

petebacondarwin wants to merge 1 commit into
mainfrom
codex/remove-cf-vite

Conversation

@petebacondarwin

@petebacondarwin petebacondarwin commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Remove the experimental internal cf-vite executable so Vite projects use Vite's CLI or their framework's own dev/build commands. This removes the shim, CLI source and parsers, package bin/file wiring, separate build entry, delegate-only caller-name/force-local environment bridges, obsolete tests, and guidance. The Vite plugin export and normal Vite CLI workflows remain supported. remoteBindings: false is the configuration path for local bindings; the shared CLOUDFLARE_PREVIEW_BUILD contract remains in place. Includes a minor changeset for the experimental executable removal.

Remaining release dependency: a compatible cf release from cloudflare/cf#540 and its RC companion #634. Autoconfig 0.13.0 is published and includes workers-sdk#16803. Current cf releases still resolve <pluginRoot>/bin/cf-vite when no framework dev/build command is detected. This affects cf dev, cf build, cf deploy, cf workers versions create, cf previews deploy, and other workflows that build first.

Autoconfig now owns the choice of Vite versus Vite+, including native fallback commands for projects without a detected framework command. It retains local plugin/tool resolution and v2 compatibility checks, reads the selected package's binary metadata, and returns dev/build commands for cf to execute through its shared project command runner. The cf companion preserves argument/mode forwarding, Preview context, credential isolation, and exit handling, and shuts down the complete command tree so vp dev cannot leave its child Vite server running. Native tool options apply; callers must use the plugin's remoteBindings option instead of the removed delegate's --local flag.

Land and release the cf changes next. Record the minimum compatible cf release here and in release communication before merging/releasing this removal. That routing works with the plugin before and after removal. This PR remains draft pending the compatible cf release. Combined smoke tests with the updated cf#540 and this plugin build passed for both Vite and Vite+: cf dev served a Worker and stopped on SIGTERM, and builds emitted the correct staging mode and normal/Preview context with cf-vite absent.

Validation (Node.js 22.22.1, pnpm 10.33.0):

  • pnpm check passed (204 tasks).
  • pnpm -F @cloudflare/vite-plugin test passed (259 tests in 30 files); the focused config, Preview environment, and package source-map tests also passed.
  • A temporary Worker served requests through vite dev --host 127.0.0.1 --port 0 --strictPort and stopped on SIGTERM. Native vite build --mode staging emitted Build Output with the correct mode for both normal and Preview builds.
  • Default and SOURCEMAPS=false release builds passed package source-map tests. Packed package inspection confirmed the plugin export and types remain, no executable or cf-vite build artifacts are included, and the release package has no source maps.
  • Changeset and PR description validators passed.

  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: this removes an experimental internal delegate; package guidance and the changeset describe migration to Vite/framework commands, and the coordinated cf release dependency is documented above.

A picture of a cute animal (not mandatory, but encouraged)

Note

This is a contribution from an AI agent: Codex.

@changeset-bot

changeset-bot Bot commented Nov 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 657126f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudflare/vite-plugin Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

"bin": {
"cf-vite": "./bin/cf-vite"
},
"files": [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current cf resolver still selects @cloudflare/vite-plugin and attempts to spawn <pluginRoot>/bin/cf-vite when no project/framework command is available. Removing the package’s bin directory here therefore makes cf dev fail for those projects, and runBuild() has the same fallback for deploy/preview flows. The open cloudflare/cf#286 does not replace this resolver or the build fallback, so this must remain unreleased until a compatible cf version routes both paths through Vite and the release is gated on that version.

@ask-bonk

ask-bonk Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

I'm Bonk, and I've done a quick review of your PR.

Removes the internal cf-vite executable and related integration code.

  • Posted 1 actionable inline finding.

github run

@petebacondarwin petebacondarwin added the blocked Blocked on other work label Nov 6, 2026
@pkg-pr-new

pkg-pr-new Bot commented Nov 6, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@16759

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@16759

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@16759

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@16759

@cloudflare/containers-shared

npm i https://pkg.pr.new/@cloudflare/containers-shared@16759

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@16759

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@16759

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@16759

miniflare

npm i https://pkg.pr.new/miniflare@16759

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@16759

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@16759

@cloudflare/runtime-types

npm i https://pkg.pr.new/@cloudflare/runtime-types@16759

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@16759

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@16759

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@16759

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@16759

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@16759

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@16759

wrangler

npm i https://pkg.pr.new/wrangler@16759

commit: 657126f

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

Labels

blocked Blocked on other work

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

1 participant