Does this mean that Wasm with Base64-encoded Data URLs does not work with Cloudflare Pages?
Does this mean that Wasm with Base64-encoded Data URLs does not work with Cloudflare Pages?
vite.config.ts like so (or add these lines)VITE_ will be exposed to the build without that config change, yes https://vite.dev/guide/env-and-mode.html#env-variablesVITE_ prefix into import.meta.env, which is why that config change is requiredCF_PAGES_COMMIT_SHA doesn't start with VITE_ and so Vite hides it because it assumes you don't want to expose it to client code




wrangler secrets put to put on deployed appCannot apply new-class migration to class 'DurableObject' that is already depended on by existing Durable Objects [code: 10074], As per chatgpt it might be because I need to update the v in the workers. Does anyone have any idea and do I need to update the version everytime?
cache parameter, VS Code complains about this:CF_PAGES_COMMIT_SHAwrangler secrets putCannot apply new-class migration to class 'DurableObject' that is already depended on by existing Durable Objects [code: 10074]v{
"code": 10021,
"message": "Uncaught SyntaxError: Unexpected token 'export'\n at worker.js:474\n"
}curl "https://api.cloudflare.com/client/v4/accounts/{acount}/workers/scripts/{worker}" \
-X PUT \
-H "Authorization: Bearer {token}" \
-H "Content-Type: multipart/form-data" \
--form "script=@worker.js;type=application/javascript" \
--form "metadata={\"main_module\": \"worker.js\", \"compatibility_date\": \"2025-04-02\", \"compatibility_flags\": [\"nodejs_compat\"]};type=application/json"cacheObject literal may only specify known properties, and 'cache' does not exist in type 'RequestInit<RequestInitCfProperties>'.ts(2353)import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
define: {
"import.meta.env.CF_PAGES": JSON.stringify(process.env.CF_PAGES || "1"),
"import.meta.env.CF_PAGES_URL": JSON.stringify(process.env.CF_PAGES_URL || "unresolved"),
"import.meta.env.CF_PAGES_BRANCH": JSON.stringify(process.env.CF_PAGES_BRANCH || "unresolved"),
"import.meta.env.CF_PAGES_COMMIT_SHA": JSON.stringify(process.env.CF_PAGES_COMMIT_SHA || "unknown"),
},
})function encodeBase64Bytes(bytes: Uint8Array): string {
return btoa(
bytes.reduce((acc, current) => acc + String.fromCharCode(current), "")
);
}function encodeBase64Bytes(bytes: Uint8Array): string {
const decoder = new TextDecoder('latin1');
const text = decoder.decode(bytes);
return btoa(text);
}