Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 2.15 KB

plugin.md

File metadata and controls

39 lines (27 loc) · 2.15 KB
outline deep

Plugin and Configuration {#plugin}

voidPlugin(options?) {#voidplugin-options}

Named export from "void". Returns an array of Vite plugins that set up file-based routing, migration support, and the Cloudflare Workers runtime. Application-level configuration is read from void.config.ts; the optional options object controls Vite/Cloudflare plugin behavior.

import { voidPlugin } from 'void';

export default defineConfig({
  plugins: [voidPlugin()],
});
Option Type Description
persistTo string Directory path for persisting local dev state (D1, KV, R2). Defaults to .void/ in the project root.
auxiliaryWorkers AuxiliaryWorkerConfig[] Additional Workers to run alongside your app, such as a separate API Worker and dashboard that share bindings. Each entry accepts configPath (JSON, JSONC, or TOML), config (settings or a callback), viteEnvironment, and devOnly.

Project configuration {#project-configuration}

defineConfig(config) {#defineconfig-config}

Import from void/config in the root void.config.ts. It returns the config with editor completion and TypeScript checking. Void validates the result when loading it, including values computed at runtime.

import { defineConfig } from 'void/config';

export default defineConfig({
  cloudflare: { name: 'my-app' },
  routing: { revalidate: 60 },
});

See the config reference for all fields.