Astro v6.1.3
Vite v7.3.1
Node v25.8.2
System macOS (x64)
Package Manager npm
Output static
Adapter @astrojs/cloudflare (v13.1.7)
Integrations none
N/A (build-time issue)
When using @astrojs/cloudflare with hybrid output (mix of prerendered and server-rendered pages), console.log and console.warn calls that execute inside workerd during the prerender phase are silently swallowed. No output appears in the build log.
The prerenderer creates its own Vite preview server with logLevel: "error":
// node_modules/@astrojs/cloudflare/dist/prerenderer.js, line 26-34
previewServer = await preview({
configFile: false,
// ...
logLevel: "error", // <-- suppresses info/warn output
// ...
plugins: [cfVitePlugin({ ...cfPluginConfig, viteEnvironment: { name: "prerender" } })]
});Worker console.log/console.warn output flows through miniflare's structured logging into ViteMiniflareLogger.info(), which delegates to Vite's logger. Since logLevel: "error", Vite drops anything below error level.
Additionally, because configFile: false is set, user Vite plugins cannot intercept or configure this internal preview server.
console.log and console.warn output from workerd during prerendering should appear in the build output, just as they do during astro dev.
This is especially important for debugging prerender-time issues — data fetching errors, missing environment variables, or unexpected data shapes that produce incorrect HTML without any visible error.
The prerender Vite preview server could use logLevel: "info" (or at least "warn") so that worker console output is not suppressed:
previewServer = await preview({
configFile: false,
// ...
logLevel: "info", // or "warn" as a compromise
// ...
});Alternatively, the @cloudflare/vite-plugin could bypass the Vite logger for worker console output and write directly to process.stderr, which would be independent of the Vite log level.
https://github.com/adamchal/cloudflare-prerender-logs
- I am willing to submit a pull request for this issue.