Skip to content

Commit 9cf97c1

Browse files
authored
docs: Update Cloudflare hosting guide (#5357)
1 parent 5f8d539 commit 9cf97c1

File tree

1 file changed

+12
-22
lines changed

1 file changed

+12
-22
lines changed

docs/start/framework/react/hosting.md

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,15 @@ Once you've chosen a deployment target, you can follow the deployment guidelines
3737
</picture>
3838
</a>
3939

40-
### Cloudflare Workers
41-
4240
When deploying to Cloudflare Workers, you'll need to complete a few extra steps before your users can start using your app.
4341

44-
1. Install `@cloudflare/vite-plugin`
42+
1. Install `@cloudflare/vite-plugin` and `wrangler`
4543

4644
```bash
47-
pnpm install @cloudflare/vite-plugin -D
45+
pnpm add -D @cloudflare/vite-plugin wrangler
4846
```
4947

50-
2. Update `vite.config.ts`
51-
52-
Add the cloudflare plugin to your `vite.config.ts` file.
48+
2. Add the Cloudflare plugin to your `vite.config.ts` file
5349

5450
```ts
5551
// vite.config.ts
@@ -67,42 +63,36 @@ export default defineConfig({
6763
})
6864
```
6965

70-
3. Install `wrangler`
71-
72-
```bash
73-
pnpm add wrangler -D
74-
```
75-
76-
4. Add a `wrangler.json` config file
66+
3. Add a `wrangler.jsonc` config file
7767

7868
```json
7969
{
8070
"$schema": "node_modules/wrangler/config-schema.json",
8171
"name": "tanstack-start-app",
8272
"compatibility_date": "2025-09-02",
8373
"compatibility_flags": ["nodejs_compat"],
84-
"main": "@tanstack/react-start/server-entry",
85-
"vars": {
86-
"MY_VAR": "Hello from Cloudflare"
87-
}
74+
"main": "@tanstack/react-start/server-entry"
8875
}
8976
```
9077

91-
5. Modify package.json script
78+
4. Modify the scripts in your `package.json` file
9279

9380
```json
9481
{
9582
"scripts": {
9683
"dev": "vite dev",
9784
"build": "vite build && tsc --noEmit",
85+
// ============ 👇 remove this line ============
9886
"start": "node .output/server/index.mjs",
99-
// ============ 👇 add this line ============
100-
"deploy": "wrangler deploy"
87+
// ============ 👇 add these lines ============
88+
"preview": "vite preview",
89+
"deploy": "wrangler deploy",
90+
"cf-typegen": "wrangler types"
10191
}
10292
}
10393
```
10494

105-
6. Build and deploy
95+
5. Build and deploy
10696

10797
```bash
10898
pnpm run build && pnpm run deploy

0 commit comments

Comments
 (0)