Skip to content

vinext deploy --prerender-all fails: deploy build doesn't emit prerender secret/dist → 'No build output found in dist' #17

Description

@hyf0

Summary

vinext deploy --prerender-all always fails at the pre-render step with No build output found in dist (preceded by prerender secret not found). The deploy's build phase (createBuilder().buildApp() with @cloudflare/vite-plugin active) emits the Cloudflare Worker bundle but not the dist/server output + prerender secret that the subsequent runPrerender() needs — so the prerender step can't run.

This matters because --prerender-all is the only documented way to make an fs-backed Pages Router SSG app work on Workers (see #15). Combined with #15 (plain vinext deploy runs getStaticProps per request → fs unavailable on Workers → 500), the result is: there is currently no working vinext deploy path for a Pages Router app whose getStaticProps reads the filesystem at build time.

Log — Cloudflare Workers Build, npx vinext deploy --prerender-all

✓ built in 4.21s
  Pre-rendering all routes...
[vinext] Warning: prerender secret not found. /__vinext/prerender/* endpoints will
         return 403 and dynamic routes will produce no paths. Run `vinext build`
         to regenerate the secret.
[vinext] No build output found in /opt/buildhome/repo/dist
Run `vinext build` first.
Failed: error occurred while running deploy command

Reproduces locally

  • vinext build --prerender-all with cloudflare() active → same No build output found in dist (the ✓ built in ~1s, 8xx modules line is the worker-only build; the native dist/server entry + secret are never produced).
  • vinext build --prerender-all with cloudflare() removed → succeeds, Prerendered 809 routes, and vinext start then serves every route 200 with zero per-request fs. So the prerender machinery itself is fine — it's specifically incompatible with the cloudflare build output.

Root conflict

  • runPrerender needs vinext's native dist/server build + the prerender secret, which are generated by vinext build's own build path (cli.js), not by createBuilder().buildApp().
  • vinext deploy builds via buildApp(), which under @cloudflare/vite-plugin emits a workerd Worker and neither the dist/server entry nor the secret.
  • Net: prerender requires cloudflare OFF; the workerd Worker requires cloudflare ON. They're mutually exclusive in 0.1.8. No flag arrangement yields both — incl. the split vinext build --prerender-all (cloudflare off → Node-targeted build, not a workerd Worker) followed by vinext deploy --skip-build.

Expected

vinext deploy --prerender-all should generate the prerender secret + the prerenderable dist/server output (e.g. run the native build, or have buildApp emit it) before runPrerender, so prerendered SSG pages ship as static assets alongside the Worker.

Related upstream (cloudflare/vinext)

Environment

vinext 0.1.8, Vite 8.1, Pages Router, Cloudflare Workers Build (/opt/buildhome/repo).

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2: mediumWorth doing, not urgentarea: deployCloudflare Workers deployupstream: roadmapTracked upstream; architectural

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions