Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`cf deploy` duplicates the build step when `--prebuilt` flag is not used

Open
#183 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Active
Tech stack
typescript, vite

Research direction

Start with the cf deploy and cf build command entry points and reproduce the behavior using the commands and Vite+ setup described in the issue. Compare how --prebuilt, existing .cloudflare/output/v0, and project build scripts are handled; done means the chosen behavior avoids an unintended duplicate build without breaking deployment.

Written by the indexing model from the issue text.

Description

In Cloudflare's dashboard, "build" and "deploy" are two separate steps, and cf deploy builds automatically without setting --prebuilt. This is quite confusing when migrating from wrangler (e.g., a drop-in replacement of npx wrangler deploy with npx cf deploy) and causes several issues when the deploy command is set to pnpm|npx cf deploy:

  • It duplicates the build. cf runs its own build step again even when the build command was set and executed. Unnecessarily increases build time.
  • There is a risk of unexpected overwriting of object code when cf's chosen build script differs from the user's. This can be very difficult to debug in certain edge cases.
  • This behavior cannot be configured. Seems like cf detects the project layout and chooses the toolchain automatically. There is no config item to set a build script.
  • Specifically, for projects using Vite+, where vite was linked to npm:@voidzero-dev/[email protected] and the vite CLI was never installed, cf will attempt to invoke pnpm vite build and fail.
  • npx cf build works for Vite+, but at the cost of downloading Vite again via npx vite build. This also brings the risk of version disparity.

Possible solutions:

  • Add hints on unsetting the build script when using cf deploy.
  • Allow configuring the build script in cloudflare.config.ts, mirroring wrangler. This should also smooth migration from wrangler, although the targeted UX seems to be eliminating this option.
  • Maybe skip building automatically on deploy when .cloudflare/output/v0 exists. Of course, with a flag to enforce it, like --build.
  • Would appreciate it if cf could add support for Vite+.

Off topic: I love the new CLI, much beyond wrangler, and congrats to the team who shipped such a great tool!

Dominant language
TypeScript
Stars
853
Forks
42
Avg merge
17h 57m
Merged PRs (30d)
146

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/cf

All issues in cloudflare/cf

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.