Prompt Buddy logoPrompt Buddy

cloudflare · Cloudflare Workers Docs

Workers Vite Environments

Explains how the Cloudflare Vite plugin utilizes the Vite Environment API to integrate Workers with Vite, including how to configure environment-specific settings and how to assign Workers to the ssr environment for f...

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Workers Vite Environments

Explains how the Cloudflare Vite plugin utilizes the Vite Environment API to integrate Workers with Vite, including how to configure environment-specific settings and how to assign Workers to the ssr environment for f...

When To Use

Use when you need to configure environment-specific constants in vite.config.ts or when integrating full-stack frameworks like React Router v7 with the Cloudflare Workers runtime via Vite.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/workers-vite-plugin-environments-workflow-guide.mdDocumentation explaining how the Vite Environment API integrates the Cloudflare Vite plugin with the Workers runtime.Questions about documentation explaining how the Vite Environment API integrates the Cloudflare Vite plugin with the Workers runtime.
examples/workers-vite-plugin-environments-cloudflare-workers-vite-environments-co.textA configuration file demonstrating how to define environment variables within a Cloudflare Workers Vite plugin setup.Exact payloads, commands, or snippets shown in A configuration file demonstrating how to define environment variables within a Cloudflare Workers Vite plugin setup.
examples/workers-vite-plugin-environments-cloudflare-workers-vite-environments-wr.textA wrangler.toml configuration file demonstrating the use of the vite-plugin-environments schema and compatibility date settings.Exact payloads, commands, or snippets shown in A wrangler.toml configuration file demonstrating the use of the vite-plugin-environments schema and compatibility dat...
examples/workers-vite-plugin-environments-cloudflare-workers-vite-environments-co-2.textA vite configuration file demonstrating how to define custom environments and global constants using the cloudflare workers vite plugin.Exact payloads, commands, or snippets shown in A vite configuration file demonstrating how to define custom environments and global constants using the cloudflare w...
examples/workers-vite-plugin-environments-cloudflare-workers-vite-plugin-environm.textA Vite configuration file demonstrating how to use the cloudflare plugin with a specific viteEnvironment setting.Exact payloads, commands, or snippets shown in A Vite configuration file demonstrating how to use the cloudflare plugin with a specific viteEnvironment setting.

What This Skill Covers

  • The Vite Environment API ↗, released in Vite 6, is the key feature that enables the Cloudflare Vite plugin to integrate Vite directly with the Workers runtim...
  • Main sections: Default behavior, Environment configuration, Full-stack frameworks.

Workflow

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. Do not add behavior or configuration that is not present in the attached source files.

Canonical source: https://developers.cloudflare.com/workers/vite-plugin/reference/vite-environments