ah so it will look in the static folder first for like robots.txt, and if that's a miss, then invoke
ah so it will look in the static folder first for like robots.txt, and if that's a miss, then invoke my Worker?
env.ASSETS.fetch right?selflare to dev locally for pages ?Cannot read properties of undefined (reading 'get')functions in my (react) pages project, this folder will be use for the "backend" (receive request) where I can safely import my Secrets (using env). GET or HEAD. As best I can tell, this should make it impossible for users to modify our files, unless they can somehow modify the code of the worker itself (I assume they can't). Is that correct, or is there something else I need to do to make sure our web build is secure?CompileError: WebAssembly.instantiate(): Wasm code generation disallowed by embedder.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
env.ASSETS.fetchapp.get('/*', (c) => {
return c.env.ASSETS.fetch(c.req.raw);
});selflareCannot read properties of undefined (reading 'get')functionsSecretsGETHEADCompileError: WebAssembly.instantiate(): Wasm code generation disallowed by embedderVITE_VITE_VITE_CF_PAGES_COMMIT_SHAname = "correct-worker-name"
main = "worker.js"
compatibility_date = "2023-08-23"
kv_namespaces = [
{ binding = "WORKER_KV", id = "correctid-123" }
]export default {
async fetch(request, env, ctx) {
const value = await env.WORKER_KV.get("thecorrectkey-123");
return new Response(value);
},
};{
"result": null,
"success": false,
"errors": [
{
"code": 7010,
"message": "Service unavailable"
}
],
"messages": [
]
} "assets": {
"directory": "./dist",
"binding": "ASSETS"
}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"),
},
})