cloudflare / cloudflare/vinext

init --platform cloudflare: generated `deploy:vinext` points at `dist/server/wrangler.json`, but the build emits `dist/<worker-name>/wrangler.json`

Open
#2,965 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
8.8k
Forks
406
Avg merge
2d 6h
Merged PRs (30d)
120

Description

## Problem

`vinext init --platform cloudflare` adds a deploy script pointing at a path the Cloudflare build never produces:

```json
"deploy:vinext": "vinext-cloudflare deploy --config dist/server/wrangler.json"
```

With `@cloudflare/vite-plugin`, `vinext build` emits the Worker (and its generated `wrangler.json`) into `dist//`, following the plugin's own output convention. For a Worker named `my-app` in `wrangler.jsonc`, the build produces:

```
dist/
├── client/
└── my-app/
├── index.js
├── wrangler.json <-- generated config lives here
└── .dev.vars
```

`dist/server/wrangler.json` does not exist, so the scaffolded deploy script cannot work as generated. It only coincides for a project whose Worker happens to be named `server`.

## Reproduction

1. Scaffold a Pages Router project for Cloudflare:

```sh
vinext init --platform cloudflare --skip-check
```

2. Build:

```sh
vinext build
```

3. Compare the generated script with the build output:

```sh
$ grep deploy:vinext package.json
"deploy:vinext": "vinext-cloudflare deploy --config dist/server/wrangler.json"

$ ls dist/server/wrangler.json
ls: dist/server/wrangler.json: No such file or directory

$ ls dist/*/wrangler.json
dist/my-app/wrangler.json
```

## Expected

The generated `deploy:vinext` script points at the config the build actually emits — resolved from the Worker name in `wrangler.jsonc` (or discovered at deploy time) rather than hard-coded to `dist/server/`.

## Environment

- vinext `1.0.0-beta.6`
- `@cloudflare/vite-plugin`, `wrangler` `4.123.0`
- Vite `8.1.0`
- Pages Router, `vinext init --platform cloudflare`

## Related

Same root cause as the `vinext start` mismatch I am filing alongside this: Cloudflare output goes to `dist//`, while the surrounding tooling assumes `dist/server/`.

Contributor guide

Open the contributing guide

Research direction

Start with the Cloudflare scaffold generated by `vinext init --platform cloudflare`, especially the `deploy:vinext` entry in `package.json`, and compare it with the Worker name in `wrangler.jsonc`. Run `vinext build` and inspect `dist/*/wrangler.json`; done means the generated deploy script targets the config emitted for the configured Worker rather than assuming `dist/server/`.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vite
Domain
build-system, cli, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.