@@ -37,19 +37,15 @@ Once you've chosen a deployment target, you can follow the deployment guidelines
37
37
</picture >
38
38
</a >
39
39
40
- ### Cloudflare Workers
41
-
42
40
When deploying to Cloudflare Workers, you'll need to complete a few extra steps before your users can start using your app.
43
41
44
- 1 . Install ` @cloudflare/vite-plugin `
42
+ 1 . Install ` @cloudflare/vite-plugin ` and ` wrangler `
45
43
46
44
``` bash
47
- pnpm install @cloudflare/vite-plugin -D
45
+ pnpm add -D @cloudflare/vite-plugin wrangler
48
46
```
49
47
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
53
49
54
50
``` ts
55
51
// vite.config.ts
@@ -67,42 +63,36 @@ export default defineConfig({
67
63
})
68
64
```
69
65
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
77
67
78
68
``` json
79
69
{
80
70
"$schema" : " node_modules/wrangler/config-schema.json" ,
81
71
"name" : " tanstack-start-app" ,
82
72
"compatibility_date" : " 2025-09-02" ,
83
73
"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"
88
75
}
89
76
```
90
77
91
- 5 . Modify package.json script
78
+ 4 . Modify the scripts in your ` package.json ` file
92
79
93
80
``` json
94
81
{
95
82
"scripts" : {
96
83
"dev" : " vite dev" ,
97
84
"build" : " vite build && tsc --noEmit" ,
85
+ // ============ 👇 remove this line ============
98
86
"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"
101
91
}
102
92
}
103
93
```
104
94
105
- 6 . Build and deploy
95
+ 5 . Build and deploy
106
96
107
97
``` bash
108
98
pnpm run build && pnpm run deploy
0 commit comments