Vite
Source:
src/Cloudflare/Website/Vite.ts
A Cloudflare Worker deployed from a Vite project.
Vite uses the Cloudflare Vite plugin to build both the server bundle
and client assets in a single vite build invocation — no manual
main entrypoint, build command, output directory, or Wrangler
configuration required.
Input files are content-hashed (respecting .gitignore by default) so
unchanged projects skip the build and deploy entirely.
Deploying a Static Site
Section titled “Deploying a Static Site”For a pure static site (no SSR), a single call is all you need. Vite builds the project and Alchemy deploys the output as a Cloudflare Worker with static assets.
const site = yield* Cloudflare.Vite("Website");SSR Frameworks
Section titled “SSR Frameworks”For SSR frameworks like TanStack Start, SolidStart, or Nuxt, enable
nodejs_compat so the server bundle can use Node.js APIs.
TanStack Start
const app = yield* Cloudflare.Vite("TanStackStart", { compatibility: { flags: ["nodejs_compat"], },});SolidStart with worker-first routing
const app = yield* Cloudflare.Vite("SolidStart", { compatibility: { flags: ["nodejs_compat"], }, assets: { config: { runWorkerFirst: true }, },});Single-Page Applications
Section titled “Single-Page Applications”For SPAs (React, Vue, etc.), configure asset handling so all
routes fall back to index.html.
const app = yield* Cloudflare.Vite("Vue", { compatibility: { flags: ["nodejs_compat"], }, assets: { config: { htmlHandling: "auto-trailing-slash", notFoundHandling: "single-page-application", }, },});Custom Rebuild Scope
Section titled “Custom Rebuild Scope”By default, every non-gitignored file is hashed to decide whether
a rebuild is needed. Use memo to narrow the scope when your
project has large directories that don’t affect the build output.
const site = yield* Cloudflare.Vite("Docs", { memo: { include: ["src/**", "content/**", "package.json"], },});