[C3] React framework path does not generate Vite-plugin template; --variant undocumented and --accept-defaults does not suppress variant prompt

Open
#17,221 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
56/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, react, typescript, vite

Research direction

Start by reading the C3 CLI arguments documentation and the React framework guide, then trace how --variant and --accept-defaults are handled for React starters. Compare the documented commands with the reported C3 v2.75.1 behavior and the react-starter-template path. Done means the variant flag and its accepted values, defaults prompt behavior, and React scaffold instructions accurately describe the supported paths.

Written by the indexing model from the issue text.

Description

Which Cloudflare product(s) does this pertain to?

C3 (create-cloudflare) and the React framework guide.

What version(s) of the tool(s) are you using?

create-cloudflare v2.75.1. Wrangler 4.136.1 was installed by the working template.

What version of Node are you using?

v22.22.3

What operating system and version are you using?

Windows 11, Windows PowerShell 5.1, npm 12.2.3.

Describe the bug

Three related CLI/documentation mismatches surfaced while scaffolding a React + TypeScript + Vite app for Workers:

  1. --variant is a real, validated C3 flag, but it is absent from the C3 CLI arguments documentation. --lang=ts does not select the variant for framework starters. This appears to be the flag implemented for #9600, but the public docs still do not describe it.
  2. --accept-defaults does not suppress the interactive “Select a variant” prompt.
  3. The React framework guide says npm create cloudflare@latest -- my-react-app --framework=react scaffolds a React SPA, Workers API, and the Cloudflare Vite plugin. In C3 v2.75.1, --framework=react delegates to plain create-vite --template react-ts and a separate Cloudflare configuration step. The result has no @cloudflare/vite-plugin, no run_worker_first, an auto-selected compatibility date, and the directory name as the Worker name. The plugin-enabled template only came from --template=cloudflare/templates/react-starter-template.
Steps to reproduce

Attempt 3 — --lang=ts does not select the variant:

npx --yes create-cloudflare@latest production-starter --framework=react --lang=ts --no-deploy --no-open --no-git

Attempt 4 — invalid --variant value is validated:

npx --yes create-cloudflare@latest production-starter --framework=react --platform=workers --variant=ts --deploy=false --open=false --git=false --no-agents

Attempt 6 — --accept-defaults still stops at the variant prompt:

npx --yes create-cloudflare@latest production-app --framework=react --accept-defaults --no-deploy --no-open --no-git --no-agents

Attempt 7 — --variant=react-ts works but delegates to create-vite:

npx --yes create-cloudflare@latest production-app --framework=react --variant=react-ts --no-deploy --no-open --no-git --no-agents

Working plugin-enabled path:

npx --yes create-cloudflare@latest production-official --template=cloudflare/templates/react-starter-template --no-deploy --no-open --no-git
Expected behavior
  • --variant should be documented with its accepted React values (react-ts, react), especially since --lang=ts does not drive framework-variant selection.
  • --accept-defaults should suppress the variant prompt, or its limits should be documented.
  • The React guide should either reflect that --framework=react produces the plain Vite + Wrangler configuration in v2.75.1, or state that the plugin-based template must be requested with --template=cloudflare/templates/react-starter-template.
Actual behavior / verbatim evidence

Attempt 3 output:

╭ Create an application with Cloudflare Step 1 of 3
│
├ In which directory do you want to create your application?
│ dir ./production-starter
│
├ What would you like to start with?
│ category Framework Starter
│
├ Which development framework do you want to use?
│ framework React
│
├ Select your deployment platform
│ platform Workers with Assets
│
╰ Select a variant:
  ● TypeScript
  ○ JavaScript

Attempt 4 output:

╰  ERROR  Error: Unknown variant "ts". Valid variants are: react-ts, react
C3 failed with exit code 1

Attempt 6 output:

╰ Select a variant:
  ● TypeScript
  ○ JavaScript

Attempt 7 output, showing delegation to plain Vite:

├ Continue with React via `npx [email protected] production-app --template react-ts --no-immediate`

The scaffold from attempt 7 had no @cloudflare/vite-plugin in package.json, vite.config.ts contained only @vitejs/plugin-react, and the partially generated wrangler.jsonc still had <WORKER_NAME> and <COMPATIBILITY_DATE> placeholders after a timeout. A separate completed run with --platform=workers --variant=react-ts produced the same no-plugin result cleanly, with name: "production-starter", compatibility_date: "2026-11-23", assets.not_found_handling: "single-page-application", and no run_worker_first.

The official template run produced the expected plugin wiring:

production-official\package.json:21:  "@cloudflare/vite-plugin": "1.52.1",
production-official\vite.config.ts:3:import { cloudflare } from "@cloudflare/vite-plugin";
production-official\vite.config.ts:6:  plugins: [react(), cloudflare()],
Additional context

Two other confirmed gotchas, though secondary to the three findings above:

  • npm create cloudflare@latest -- . --framework=react ... fails on npm 12 with EUNKNOWNCONFIG / “Unknown cli flags: --framework --deploy --open”. npx create-cloudflare@latest ... is the reliable form here.
  • C3 rejects . as a project name: “Project names must only contain lowercase characters, numbers, and dashes.”
  • --no-agents is a real flag; without it C3 prompts whether to add AGENTS.md.

The working project builds cleanly with npm run build; the Vite plugin emits dist/<worker>/wrangler.json and dist/client, which confirms why the deploy workflow must build before calling Wrangler.

Dominant language
TypeScript
Stars
4.7k
Forks
1.7k
Avg merge
1d 22h
Merged PRs (30d)
282

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cloudflare/workers-sdk

All issues in cloudflare/workers-sdk

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.