`cf deploy` duplicates the build step when `--prebuilt` flag is not used
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
- Domain
- build-system, cli, developer-experience
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.
cfruns 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
cfdetects the project layout and chooses the toolchain automatically. There is no config item to set a build script. - Specifically, for projects using Vite+, where
vitewas linked tonpm:@voidzero-dev/[email protected]and theviteCLI was never installed,cfwill attempt to invokepnpm vite buildand fail. npx cf buildworks for Vite+, but at the cost of downloading Vite again vianpx 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/v0exists. Of course, with a flag to enforce it, like--build. - Would appreciate it if
cfcould 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
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cloudflare/cf
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cloudflare/cf#344 ·
Maintainers usually reply within 1 day
-
upstream
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
cloudflare/cf#262 ·
Maintainers usually reply within 1 day
-
`cf dev` rejects `--port` and `--host` for Vite projects, including the `cf init` templatePossibly taken @jamesopstad claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
cloudflare/cf#223 · 2 assignees ·
Maintainers usually reply within 1 day
-
upstream
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
cloudflare/cf#179 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 58/100
cloudflare/cf#347 ·
Maintainers usually reply within 1 day
Similar issues
-
freshness freshness:observed-only
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
thoroc/context-radar#280 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
documentation story
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
bug category:billing priority:p3 track:fast
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
LanternOps/breeze#9223 ·
Maintainers usually reply within 1 day