diff --git a/api/boot.ts b/api/boot.ts index 76b59b4..d748031 100644 --- a/api/boot.ts +++ b/api/boot.ts @@ -24,7 +24,7 @@ app.all("/api/*", (c) => c.json({ error: "Not Found" }, 404)); export default app; -if (env.isProduction) { +if (env.isProduction && typeof process !== "undefined" && process.versions?.node) { const { serve } = await import("@hono/node-server"); const { serveStaticFiles } = await import("./lib/vite"); serveStaticFiles(app); diff --git a/wrangler.toml b/wrangler.toml new file mode 100644 index 0000000..53e0fd9 --- /dev/null +++ b/wrangler.toml @@ -0,0 +1,9 @@ +name = "webgispemetaankemiskinan" +main = "api/boot.ts" +compatibility_date = "2024-03-01" +compatibility_flags = [ "nodejs_compat" ] + +[assets] +directory = "./dist/public" +not_found_handling = "single-page-application" +run_worker_first = ["/api/*"]