Files
cloudflare__vinext/packages/cloudflare
github-actions[bot] 2b2ed00f22 chore: version packages (#1759)
* chore: version packages

* add header

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: James <james@eli.cx>
2026-06-08 09:45:43 +00:00
..
2026-06-08 09:45:43 +00:00
2026-06-08 09:45:43 +00:00

@vinext/cloudflare

Cloudflare cache adapters for vinext.

This package provides the Cloudflare-specific cache backends that vinext uses for ISR and the "use cache" data cache when deploying to Cloudflare Workers:

  • kvDataAdapter() (@vinext/cloudflare/cache/kv-data-adapter) — backs the data cache (fetch, "use cache", unstable_cache) with a Workers KV namespace.
  • cdnAdapter() (@vinext/cloudflare/cache/cdn-adapter) — backs full-route, edge-managed page-level ISR with the Workers Cache API.

Usage

Declare the adapters on the vinext() plugin in your Vite config:

import { cdnAdapter } from "@vinext/cloudflare/cache/cdn-adapter";
import { kvDataAdapter } from "@vinext/cloudflare/cache/kv-data-adapter";

export default defineConfig({
  plugins: [
    vinext({
      cache: {
        data: kvDataAdapter(), // KV-backed data cache (binding: VINEXT_KV_CACHE)
        cdn: cdnAdapter(), // optional: edge-managed page-level ISR
      },
    }),
    cloudflare(),
  ],
});