Vite 6, a groundbreaking release
Vite 6 was released yesterday and introduces a groundbreaking new API: the Environment API.
It's a low-level API and you'll probably never directly interact with it, but its impact is profound for users.
Edit for reddit folks:
- Vike (with k) is a framework like Next.js/Nuxt that is built on top of Vite (with t) which is a bundler like webpack. Both projects are unaffiliated (atlthough we often collaborate).
- The Vite 6 announcement post (see link above) doesn't explain the benefits of the Environment API for users; this blog post gives a high-level explanation of what it unlocks.
What does it mean for users?
The most notable benefit is that you'll be able to develop directly against edge environments. For example, you'll be able to develop your workerd code (your Cloudflare Worker) while getting the full Vite experience such as HMR.
In other words, you will develop code that works equally well between dev and prod. You'll get a unified stack.
This is major milestone for edge deployment, as you will develop for the edge (Cloudflare Workers, Vercel Edge, ...) as conveniently as for a Node.js/Bun/Deno server.
The Environment API has been developed with tight feedback from the Cloudflare Workers team.
What does it mean for Vike users?
Concretely, as a Vike user, you'll simply install vike-cloudflare
and vike-hono
and then develop your Hono code directly against Cloudflare Workers. Everything is automatically integrated, so there isn't any glue code for you to write.
We're currently working on these extensions as we speak (and many more such as vike-vercel
, vike-express
, vike-fastify
, ...).
Staying true to Vike's flexible nature, you'll be able to eject glue code if you have requirements that need it.
We already implemented the groundwork and we're currently working on bringing everything together. For example, we've implemented universal-middleware
which is essentially the glue code between tools (Vike/Telefunc/...), the deployment environment (Node.js/Cloudflare/Vercel/...), and the server framework (Hono/Express.js/Fastify/...).
We're making a lot of progress and we'll probably release something later this year.
Closing words
The Environment API is a structural improvement to Vite (it now has multiple module graphs), enabling not only what we just discussed but also enabling Vite-based frameworks to implement new techniques such as React Server Components (it requires its own separate module graph).
The future looks bright.