diff --git a/docs/start/framework/react/hosting.md b/docs/start/framework/react/hosting.md index fba7a7f00da..845566a3518 100644 --- a/docs/start/framework/react/hosting.md +++ b/docs/start/framework/react/hosting.md @@ -40,8 +40,13 @@ Once you've chosen a deployment target, you can follow the deployment guidelines ### Cloudflare Workers When deploying to Cloudflare Workers, you'll need to complete a few extra steps before your users can start using your app. +1. Install `@cloudflare/vite-plugin` -1. Update `vite.config.ts` +```bash +pnpm install @cloudflare/vite-plugin -D +``` + +2. Update `vite.config.ts` Add the cloudflare plugin to your `vite.config.ts` file. @@ -60,8 +65,13 @@ export default defineConfig({ ], }) ``` +3. Install `wrangler` + +```bash +pnpm add wrangler -D +``` -2. Add a `wrangler.json` config file +4. Add a `wrangler.json` config file ```json { @@ -76,6 +86,28 @@ export default defineConfig({ } ``` +5. Modify package.json script + +```json + +{ + "scripts": { + "dev": "vite dev", + "build": "vite build && tsc --noEmit", + "start": "node .output/server/index.mjs", + // ============ 👇 add this line ============ + "deploy": "wrangler deploy" + }, +} + +``` + +6. Build and deploy + +```bash +pnpm run build && pnpm run deploy +``` + Deploy your application to Cloudflare Workers using their one-click deployment process, and you're ready to go! ### Netlify ⭐ _Official Partner_