Skip to content

void deploy --platform cloudflare ignores inference.appType: "void" and refuses a VitePress site with a backend #885

Closed

Description

@joeblew999

Void: 1.11.0, and the same code on main (92a0156). VitePress 2.0.0-alpha.21, Node 26.12.1, macOS 27.

The guide's Adding a backend to a static site says to set inference.appType: "void" so that a project with both VitePress and routes/ deploys both. With --platform cloudflare, the setting is ignored, and the deploy refuses with the message that tells you to set it.

Reproduce

The guide's own setup, plus one route:

// package.json
{ "private": true, "type": "module", "devDependencies": { "vite": "…", "void": "1.11.0", "vitepress": "2.0.0-alpha.21" } }
// void.config.ts
import { defineConfig } from "void/config";

export default defineConfig({
  inference: { appType: "void", build: "vitepress build && vite build" },
  cloudflare: { name: "void-apptype-repro" },
});
// vite.config.ts
import { defineConfig } from "vite";
import { voidPlugin } from "void";

export default defineConfig({
  plugins: [voidPlugin()],
  publicDir: ".vitepress/dist",
});
// routes/api/hello.ts
import { defineHandler } from "void";
export const GET = defineHandler(() => ({ hello: "world" }));

Plus .vitepress/config.ts and index.md. Then void deploy --platform cloudflare:

deploy: "vitepress" was detected, but this project also has backend code: routes/.
A static deploy would silently drop it, so Void will not guess. Pick one in void.config.ts:

  Deploy the static output only (the backend is NOT deployed):
    { "inference": { "appType": "static" } }

  Deploy both — the SSG emits the site, then Void packages it with the worker:
    { "inference": { "appType": "void", "build": "<ssg> build && vite build" } }
    ...and in vite.config.ts add voidPlugin() plus `publicDir: "<ssg output dir>"`,
    so the generated site is copied into the client build alongside the worker.

Controls, each run with no Cloudflare credentials:

  • With vitepress removed from package.json, the deploy passes this check and stops at the next step ("Cloudflare authentication is required").
  • With appType: "static", it passes too. So void.config.ts is read.
  • The same refusal comes with VitePress in docs/ (vitepress build docs).

Why

resolveCloudflareStaticPreset first takes resolveStaticDeployPreset's answer, which is null for appType: "void". Then, with no framework detected, it calls detectPreset(root, { strictBackend: true }) without looking at voidConfig.inference?.appType.

The platform path checks it first (if (!preset && !voidConfig.inference?.appType)). Its comment, and the strictBackend tests, say the guard is for the unconfigured path only: a configured inference.appType is "the user stating their intent". No test covers resolveCloudflareStaticPreset with appType set.

A possible fix

In resolveCloudflareStaticPreset, skip the strict detection when an app type is configured, as the platform path does. "static" and "spa" have already returned by then, so only "void" and "framework" reach it, and both mean a full Worker deploy:

if (detectFramework(root) || voidConfig.inference?.appType) {
  return null;
}

Workaround

Keep VitePress out of the app's package.json: give the docs their own workspace package, built before the app.

Activity

  1. self-assigned this
    on Nov 20, 2026
  2. added a commit that references this issue on Nov 23, 2026
    eb9f79d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions