cloudflare: enable fs with @cloudflare/vite-plugin (#239)

* init dev vite write plugin

* reorganized cf proxy, fixed dev write
This commit is contained in:
dswbx
2025-08-29 06:44:20 +02:00
committed by GitHub
parent 8f471a29b0
commit 9436b8bac5
7 changed files with 166 additions and 4 deletions

View File

@@ -1,7 +1,21 @@
import type { CloudflareBkndConfig } from "bknd/adapter/cloudflare";
import { syncTypes } from "bknd/plugins";
import { writeFile } from "node:fs/promises";
const isDev = !import.meta.env.PROD;
export default {
d1: {
session: true,
},
options: {
plugins: [
syncTypes({
enabled: isDev,
write: async (et) => {
await writeFile("bknd-types.d.ts", et.toString());
},
}),
],
},
} satisfies CloudflareBkndConfig;