API reference

Vite and Cloudflare plugins

Configuration reference for Effront’s Vite and Cloudflare Workers integrations.

effront

effront(options?: EffrontViteOptions): PluginOption[] from @effront/vite configures the application's development and build plugins. It includes React Compiler, React, and RSC plugins. Do not register those plugins again. Register a host adapter separately:

import { effront } from "@effront/vite";
import { effrontCloudflare } from "@effront/cloudflare";
import { defineConfig } from "vite-plus";

export default defineConfig({
  plugins: [effront(), effrontCloudflare()],
});

The Cloudflare Workers guide identifies the application and Wrangler files for this configuration. For the introductory create-and-run workflow, refer to Getting started.

EffrontViteOptions

OptionTypeDefaultContract
applicationstring./src/entry.effront.tsxModule default-exporting the application definition, resolved relative to Vite's root
rscstring./src/entry.workers.tsRequest entry exporting { fetch } for the default Workers integration

Effront supplies browser startup code. application selects the application definition, not a browser entry. @effront/core/application-entry resolves to that module through a Vite alias, not a standalone public package subpath. Host adapters such as effrontServer and effrontAlchemy configure their own request entries.

Effect Schema JIT has separate registrations in the browser and SSR entries. The native Node/Bun host and the RSC entry selected by effront({ rsc }) also have separate registrations.

For native hosting, align the RSC paths with plugins: [effront({ rsc: "./src/entry.rsc.ts" }), effrontServer()]. This makes JIT registration target the actual RSC entry. Refer to the graph ownership explanation.

effrontCloudflare

effrontCloudflare(options?: EffrontCloudflareOptions): PluginOption[] from @effront/cloudflare adds Cloudflare Workers development and build support. It requires a separate effront() registration.

EffrontCloudflareOptions accepts @cloudflare/vite-plugin options except viteEnvironment:

import { cloudflare } from "@cloudflare/vite-plugin";

export type EffrontCloudflareOptions = Omit<
  NonNullable<Parameters<typeof cloudflare>[0]>,
  "viteEnvironment"
>;

The adapter forwards accepted options unchanged, directly rather than under a cloudflare property. Effront fixes viteEnvironment to the RSC environment with SSR as its child. Runtime bindings are read through @effront/cloudflare/workers, not this build-time entry.

Vite settingDefault SSR output when no explicit SSR path is set
No output overridesdist/rsc/ssr
build.outDir<outDir>/rsc/ssr
environments.rsc.build.outDir<rsc outDir>/ssr, taking precedence over the root setting

An explicit environments.ssr.build.outDir takes precedence. The adapter keeps it unchanged. The selected path must remain accessible to Wrangler's Worker module bundling. Use the generated Wrangler configuration for a built Worker. Refer to Cloudflare Workers for host commands.