Skip to content

vinext deploy with a custom vite.config fails on missing cloudflare() (and the local-vs-deploy wrangler.jsonc story) #14

Description

@hyf0

Problem

vinext deploy requires cloudflare() (@cloudflare/vite-plugin) in the Vite config, but when a project has a custom vite.config.ts, vinext deploy doesn't add it and fails:

Created wrangler.jsonc
Created worker/index.ts
Error: [vinext] Missing @cloudflare/vite-plugin in your Vite config.
  ...
  Or delete your Vite config and re-run `vinext deploy` to auto-generate it.

The "delete your Vite config and re-run" suggestion isn't viable for a real port — the custom config carries required resolution/transform settings. So you must hand-add cloudflare() and install @cloudflare/vite-plugin.

Compounding it: @cloudflare/vite-plugin requires a wrangler config to exist, but vinext deploy only generates wrangler.jsonc at deploy time — so adding cloudflare() unconditionally breaks local vinext build/dev (no wrangler.jsonc). You end up either committing wrangler.jsonc or gating the plugin on its presence.

Suggested fix

  • When a custom Vite config is present, vinext deploy could inject cloudflare() (and install the dep) automatically, the same way it does when generating the config.
  • Document the local-vs-deploy story for cloudflare() + the generated wrangler.jsonc (when to commit it, how to keep local vinext dev/build working).

(Related to the Cloudflare-dashboard deploy friction in #2.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3: lowLow priority / deferarea: deployCloudflare Workers deployupstream: unfiledNeeds an issue/PR filed on cloudflare/vinext

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions