#3319·vinext

build --prerender-all crashes on cloudflare:* imports (ERR_UNSUPPORTED_ESM_URL_SCHEME)

Author: viztorCreated Sep 18, 2026Updated Sep 18, 2026

Summary

vinext build --prerender-all (equiv. vinext({ prerender: true })) crashes before rendering anything on a Cloudflare-targeted app, because the prerunner executes the server graph under plain Node.js and the graph contains cloudflare:* imports.

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. Received protocol 'cloudflare:'
    at prerenderApp (vinext/dist/build/prerender.js:564:22)
    at runPrerender (vinext/dist/build/run-prerender.js:145:25)

Observed on [email protected].

Repro

Any Cloudflare-targeted vinext app where the server graph imports cloudflare:workers — e.g. API routes reading bindings (import { env } from "cloudflare:workers"), middleware-side helpers using env/waitUntil, or vinext's own Cloudflare adapter runtime/shims. Plain vinext build succeeds (bundling never executes); only the prerender execution phase fails.

Related to #3318 (same caching story: prerender-all is the natural way to give routes static cache policies for the Cloudflare CDN adapter to enforce, so this crash blocks the documented path to edge-cached pages).

Expected

The prerunner should tolerate workerd-native imports — either by executing the prerender graph inside workerd/miniflare, or by stubbing/externalizing cloudflare:* specifiers during prerender (they are irrelevant to rendering HTML). Per-route static generation (force-static + generateStaticParams) works fine today; only the all-discovery runner is affected.