1.0 KiB
1.0 KiB
description
| description |
|---|
| Deploy Fresh on Cloudflare Workers |
Deploy Fresh to Cloudflare Workers by following these instructions:
- Run
deno install --allow-scripts npm:@cloudflare/vite-plugin npm:wrangler - Add the cloudflare plugin in your vite configuration file:
import { defineConfig } from "vite";
import { fresh } from "@paulaboks/sweet-vite";
+ import { cloudflare } from "@cloudflare/vite-plugin";
export default defineConfig({
plugins: [
fresh(),
+ cloudflare(),
],
});
- Create a
server.jsfile that serves as the cloudflare worker entry file:
import server from "./_fresh/server.js";
export default {
fetch: server.fetch,
};
- Follow further instructions provided by the cloudflare vite plugin.
Check out the Cloudflare Documentation for further information.
[info]: Make sure that you set the correct entrypoint in your
wrangler.jsoncfile. It should point to"main": "./server.js"