Problem
For a Cloudflare project, vinext init presents start:vinext as the way to run the built Worker locally:
pnpm run start:vinext Start the built Worker locally with Wrangler
but the script it writes is vinext start, which is the Node production server. It never invokes Wrangler, and it looks for build output that a Cloudflare build does not produce, so it fails immediately after a successful build:
$ vinext build
✓ built in 9.27s
$ vinext start
[vinext] No build output found in /path/to/app/dist
Run `vinext build` first.
dist/ is populated — just not where the Node server looks.
Cause
startProdServer (dist/server/prod-server.js) probes two fixed paths:
const rscEntryPath = path.join(resolvedOutDir, "server", "index.js"); // App Router
const serverEntryPath = path.join(resolvedOutDir, "server", "entry.js"); // Pages Router
const isAppRouter = fs.existsSync(rscEntryPath);
if (!isAppRouter && !fs.existsSync(serverEntryPath)) {
console.error(`[vinext] No build output found in ${outDir}`);
With @cloudflare/vite-plugin, the Worker is emitted to dist/<worker-name>/index.js per the plugin's convention, so neither path exists unless the Worker happens to be named server.
Even if the path were corrected, running a Cloudflare build under the Node server is the wrong runtime: the point of building for Workers is to exercise it on workerd, where the available APIs differ.
Reproduction
vinext init --platform cloudflare --skip-check
vinext build
vinext start # -> "No build output found"
Running Wrangler directly against the emitted config does start the Worker:
wrangler dev --config dist/<worker-name>/wrangler.json
Expected
For a project configured for Cloudflare, vinext start runs the built Worker on workerd via Wrangler, using the emitted dist/<worker-name>/wrangler.json — matching what init advertises. Node projects keep the current behaviour.
Detecting the platform from the presence of @cloudflare/vite-plugin in the Vite config (or a wrangler.jsonc in the project root) would let one command do the right thing for both targets. Failing that, init should at minimum scaffold a start:vinext that calls Wrangler for Cloudflare projects, and the "No build output found" message should mention the Cloudflare output location.
Environment
- vinext
1.0.0-beta.6
@cloudflare/vite-plugin, wrangler 4.123.0
- Vite
8.1.0
- Pages Router,
vinext init --platform cloudflare
Problem
For a Cloudflare project,
vinext initpresentsstart:vinextas the way to run the built Worker locally:but the script it writes is
vinext start, which is the Node production server. It never invokes Wrangler, and it looks for build output that a Cloudflare build does not produce, so it fails immediately after a successful build:dist/is populated — just not where the Node server looks.Cause
startProdServer(dist/server/prod-server.js) probes two fixed paths:With
@cloudflare/vite-plugin, the Worker is emitted todist/<worker-name>/index.jsper the plugin's convention, so neither path exists unless the Worker happens to be namedserver.Even if the path were corrected, running a Cloudflare build under the Node server is the wrong runtime: the point of building for Workers is to exercise it on workerd, where the available APIs differ.
Reproduction
vinext init --platform cloudflare --skip-check vinext build vinext start # -> "No build output found"Running Wrangler directly against the emitted config does start the Worker:
Expected
For a project configured for Cloudflare,
vinext startruns the built Worker on workerd via Wrangler, using the emitteddist/<worker-name>/wrangler.json— matching whatinitadvertises. Node projects keep the current behaviour.Detecting the platform from the presence of
@cloudflare/vite-pluginin the Vite config (or awrangler.jsoncin the project root) would let one command do the right thing for both targets. Failing that,initshould at minimum scaffold astart:vinextthat calls Wrangler for Cloudflare projects, and the "No build output found" message should mention the Cloudflare output location.Environment
1.0.0-beta.6@cloudflare/vite-plugin,wrangler4.123.08.1.0vinext init --platform cloudflare