Skip to content
Source
Sign inSign up
TanStack/router

docs(start): document Cloudflare Pages deployment for SPA mode #8829

Openjainamm-gala(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/8829/headopened

Showing 2 changed files with 37 additions and 0 deletions.

x
0 of 2 viewed, 2 left
34 additions and 0 deletionsdocs/start/framework/react/guide/hosting.mdModified
View file
@@ -17,6 +17,7 @@
Once you've chosen a deployment target, you can follow the deployment guidelines below to deploy your TanStack Start application to the hosting provider of your choice:
​
- [`cloudflare-workers`](#cloudflare-workers--official-partner): Deploy to Cloudflare Workers
+- [`cloudflare-pages`](#cloudflare-pages-spa-mode): Deploy an SPA mode app to Cloudflare Pages
- [`netlify`](#netlify--official-partner): Deploy to Netlify
- [`railway`](#railway--official-partner): Deploy to Railway
- [`nitro`](#nitro): Deploy using Nitro
@@ -116,6 +117,39 @@
​
A full TanStack Start example for Cloudflare Workers is available [here](https://github.com/TanStack/router/tree/main/examples/react/start-basic-cloudflare).
​
+### Cloudflare Pages (SPA mode)
+​
+An [SPA mode](./spa-mode) build can be deployed to Cloudflare Pages as static files. When a project has no top-level `404.html`, [Pages serves the root `index.html`](https://developers.cloudflare.com/pages/configuration/serving-pages/) for any path that doesn't match a static asset, so write the SPA shell to `/index.html` instead of the default `/_shell.html`:
+​
+```ts
+// vite.config.ts
+import { tanstackStart } from '@tanstack/react-start/plugin/vite'
+import { defineConfig } from 'vite'
+import viteReact from '@vitejs/plugin-react'
+​
+export default defineConfig({
+ plugins: [
+ tanstackStart({