Cloudflare

“Just use Vite”… with the Workers runtime

Apr 8, 2025James Opstad, Dario Piotrowicz, Peter Bacon Darwin, Igor Minar
“Just use Vite”… with the Workers runtime
SummaryAI, from the source post

This post introduces the 1.0 release of the Cloudflare Vite plugin and official support for React Router v7. The core technical contribution is the integration of the Vite dev server with the Cloudflare Workers runtime (workerd) via Vite's new Environment API. This allows server code to run in the native Workers runtime during development, closely matching production behavior. The post details how to create new SPAs and update existing Vite projects using the plugin, including configuration steps and code examples. It highlights the seamless development experience for both client and server code, hot module replacement without state loss, and unified build/preview/deploy workflows. The integration with React Router v7 is also detailed, showcasing how to define the Worker handler in a single file and pass `env` and `ctx` directly to loaders and actions. The post also emphasizes the broad support for the Cloudflare Developer Platform within this integration.

More from the Edge Computing with Cloudflare Workers trail