React Server Components Support
The Cloudflare Vite plugin now provides seamless integration with @vitejs/plugin-rsc, the official Vite plugin for React Server Components. This integration enables developers to build modern RSC applications directly on Cloudflare Workers.
New childEnvironments Configuration Option
A childEnvironments option has been added to the plugin configuration, allowing developers to use multiple environments within a single Worker. This enables the parent environment to import modules from child environments, creating separate module graphs for RSC use cases.
Example configuration:
export default defineConfig({
plugins: [
cloudflare({
viteEnvironment: {
name: "rsc",
childEnvironments: ["ssr"],
},
}),
],
});
Framework Integration
The underlying functionality provided by @vitejs/plugin-rsc powers frameworks like React Router that build upon it for RSC support. Cloudflare has included a basic example in the plugin repository to help developers get started with RSC on Cloudflare Workers.
This enhancement makes it easier for developers to leverage React Server Components' benefits—including improved performance, better security, and reduced client-side JavaScript—while deploying to Cloudflare's global edge network.