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

@@ -4,7 +4,7 @@ import {
registerMedia,
type CloudflareBkndConfig,
type CloudflareEnv,
} from ".";
} from "bknd/adapter/cloudflare";
import type { PlatformProxy } from "wrangler";
import process from "node:process";
@@ -41,12 +41,13 @@ export function withPlatformProxy<Env extends CloudflareEnv>(
beforeBuild: async (app, registries) => {
if (!use_proxy) return;
const env = await getEnv();
registerMedia(env, registries);
registerMedia(env, registries as any);
await config?.beforeBuild?.(app, registries);
},
bindings: async (env) => {
return (await config?.bindings?.(await getEnv(env))) || {};
},
// @ts-ignore
app: async (_env) => {
const env = await getEnv(_env);