Add basic Cloudflare E2E tests #5260
main fromrefs/pull/5260/head·merged by schiller-manuel(GitHub profile, opens in a new tab) Adds e2e/react-start/basic-cloudflare with tests.
Summary by CodeRabbit#
New Features
- Added a Cloudflare-targeted React starter with SSR-ready routing, data-loaded home page, friendly error and 404 screens, SEO meta helper, Tailwind styling, PWA manifest/icons, and scroll restoration.
Tests
- Added Playwright end-to-end tests plus automated global setup/teardown validating user agent and Cloudflare binding output.
Chores
- Added project configs for build/dev tooling, TypeScript, PostCSS/Tailwind, Vite, and Cloudflare deployment; updated ignore rules to exclude artifacts and caches.
- 1
View your CI Pipeline Execution ↗ for commit 1af5aefa58bdec79579804c21abe242ca442d606
Command Status Duration Result nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded 1m 5s View ↗ nx run-many --target=build --exclude=examples/*...✅ Succeeded 3s View ↗
☁️ Nx Cloud last updated this comment at
2025-09-26 21:03:20UTCMore templates
- tanstack-router-solid-example-basic
- tanstack-router-solid-example-basic-devtools-panel
- tanstack-router-solid-example-basic-file-based
- tanstack-router-solid-example-basic-non-nested-devtools
- tanstack-router-solid-example-basic-solid-query
- tanstack-router-solid-example-basic-solid-query-file-based
- tanstack-router-solid-example-basic-ssr-streaming-file-based
- tanstack-router-solid-example-kitchen-sink-file-based
- tanstack-router-solid-example-quickstart-file-based
- tanstack-solid-start-example-bare
- tanstack-solid-start-example-basic
- tanstack-solid-start-example-basic-static
- tanstack-router-react-example-authenticated-routes
- tanstack-router-react-example-authenticated-routes-firebase
- tanstack-router-react-example-basic
- tanstack-router-react-example-basic-default-search-params
- tanstack-router-react-example-basic-devtools-panel
- tanstack-router-react-example-basic-file-based
- tanstack-router-react-example-basic-non-nested-devtools
- tanstack-router-react-example-react-query
- tanstack-router-react-example-basic-react-query-file-based
- tanstack-router-react-example-basic-ssr-file-based
- tanstack-router-react-example-basic-ssr-streaming-file-based
- tanstack-router-react-example-basic-virtual-file-based
- tanstack-router-react-example-basic-virtual-inside-file-based
- tanstack-router-react-example-deferred-data
- tanstack-router-react-example-kitchen-sink
- tanstack-router-react-example-kitchen-sink-file-based
- tanstack-router-react-example-kitchen-sink-react-query
- tanstack-router-react-example-kitchen-sink-react-query-file-based
- tanstack-router-react-example-large-file-based
- tanstack-router-react-example-location-masking
- tanstack-router-react-example-navigation-blocking
- tanstack-router-react-example-quickstart
- tanstack-router-react-example-quickstart-esbuild-file-based
- tanstack-router-react-example-quickstart-file-based
- tanstack-router-react-example-quickstart-rspack-file-based
- tanstack-router-react-example-quickstart-webpack-file-based
- router-monorepo-react-query
- router-mono-simple
- router-mono-simple-lazy
- tanstack-router-react-example-scroll-restoration
- tanstack-search-validator-adapters
- tanstack-start-example-bare
- tanstack-start-example-basic
- tanstack-start-example-basic-auth
- tanstack-start-example-basic-cloudflare
- tanstack-start-example-basic-react-query
- tanstack-start-example-basic-static
- tanstack-start-example-convex-trellaux
- tanstack-start-example-counter
- tanstack-start-example-large
- tanstack-start-example-material-ui
- tanstack-start-example-supabase-basic
- tanstack-start-tailwind-v4
- tanstack-start-example-trellaux
- tanstack-start-example-workos
- tanstack-router-react-example-view-transitions
- tanstack-router-react-example-with-framer-motion
- tanstack-router-react-example-with-trpc
- tanstack-router-react-example-with-trpc-react-query
@tanstack/arktype-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5260@tanstack/directive-functions-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5260@tanstack/eslint-plugin-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@5260@tanstack/history
npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5260@tanstack/nitro-v2-vite-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@5260@tanstack/react-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@5260@tanstack/react-router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@5260@tanstack/react-router-ssr-query
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@5260@tanstack/react-start
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5260@tanstack/react-start-client
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5260@tanstack/react-start-server
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5260@tanstack/router-cli
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@5260@tanstack/router-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@5260@tanstack/router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@5260@tanstack/router-devtools-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@5260@tanstack/router-generator
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@5260@tanstack/router-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@5260@tanstack/router-ssr-query-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@5260@tanstack/router-utils
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@5260@tanstack/router-vite-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@5260@tanstack/server-functions-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5260@tanstack/solid-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@5260@tanstack/solid-router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@5260@tanstack/solid-start
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5260@tanstack/solid-start-client
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5260@tanstack/solid-start-server
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5260@tanstack/start-client-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5260@tanstack/start-plugin-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5260@tanstack/start-server-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5260@tanstack/start-static-server-functions
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@5260@tanstack/start-storage-context
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5260@tanstack/valibot-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5260@tanstack/virtual-file-routes
npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5260@tanstack/zod-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5260commit:
1af5aefActionable comments posted: 4
🧹 Nitpick comments (3)
e2e/react-start/basic-cloudflare/tsconfig.json (1)
9-19: Add Cloudflare/Vite ambient types to avoid implicitanysThis project includes a Cloudflare Worker entry point and Vite-driven frontend code. Without explicitly pulling in
@cloudflare/workers-typesandvite/client, strict mode will flagExecutionContext,KVNamespace,import.meta.env, etc., as missing and push teams to sprinkle manual globals. Please wire the types in here."resolveJsonModule": true, "skipLibCheck": true, "target": "ES2022", "allowJs": true, "forceConsistentCasingInFileNames": true, "baseUrl": ".", + "types": ["@cloudflare/workers-types", "vite/client"], "paths": { "~/*": ["./src/*"] },e2e/react-start/basic-cloudflare/src/components/NotFound.tsx (1)
1-25: Narrow thechildrenprop type.We can keep strict typing by using
ReactNodeinstead ofany, which helps downstream consumers and tooling.-import { Link } from '@tanstack/react-router' +import type { ReactNode } from 'react' +import { Link } from '@tanstack/react-router' -export function NotFound({ children }: { children?: any }) { +export function NotFound({ children }: { children?: ReactNode }) {e2e/react-start/basic-cloudflare/public/site.webmanifest (1)
2-3: Populate PWA manifest namesLeaving
nameandshort_nameempty yields blank labels in install prompts. Please fill these fields with a recognizable app name (even a placeholder for the sample) so the manifest produces valid metadata.📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between e55b43696911d3b78aa0a47e6bc0209315a30222 and b1ce9f8cb8b67af251361315a962e4b695ea9e9e.
⛔ Files ignored due to path filters (8)
e2e/react-start/basic-cloudflare/public/android-chrome-192x192.pngis excluded by!**/*.pnge2e/react-start/basic-cloudflare/public/android-chrome-512x512.pngis excluded by!**/*.pnge2e/react-start/basic-cloudflare/public/apple-touch-icon.pngis excluded by!**/*.pnge2e/react-start/basic-cloudflare/public/favicon-16x16.pngis excluded by!**/*.pnge2e/react-start/basic-cloudflare/public/favicon-32x32.pngis excluded by!**/*.pnge2e/react-start/basic-cloudflare/public/favicon.icois excluded by!**/*.icoe2e/react-start/basic-cloudflare/public/favicon.pngis excluded by!**/*.pngpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (21)
e2e/react-start/basic-cloudflare/.gitignore(1 hunks)e2e/react-start/basic-cloudflare/.prettierignore(1 hunks)e2e/react-start/basic-cloudflare/package.json(1 hunks)e2e/react-start/basic-cloudflare/playwright.config.ts(1 hunks)e2e/react-start/basic-cloudflare/postcss.config.mjs(1 hunks)e2e/react-start/basic-cloudflare/public/site.webmanifest(1 hunks)e2e/react-start/basic-cloudflare/src/components/DefaultCatchBoundary.tsx(1 hunks)e2e/react-start/basic-cloudflare/src/components/NotFound.tsx(1 hunks)e2e/react-start/basic-cloudflare/src/routeTree.gen.ts(1 hunks)e2e/react-start/basic-cloudflare/src/router.tsx(1 hunks)e2e/react-start/basic-cloudflare/src/routes/__root.tsx(1 hunks)e2e/react-start/basic-cloudflare/src/routes/index.tsx(1 hunks)e2e/react-start/basic-cloudflare/src/styles/app.css(1 hunks)e2e/react-start/basic-cloudflare/src/utils/seo.ts(1 hunks)e2e/react-start/basic-cloudflare/tailwind.config.mjs(1 hunks)e2e/react-start/basic-cloudflare/tests/app.spec.ts(1 hunks)e2e/react-start/basic-cloudflare/tests/setup/global.setup.ts(1 hunks)e2e/react-start/basic-cloudflare/tests/setup/global.teardown.ts(1 hunks)e2e/react-start/basic-cloudflare/tsconfig.json(1 hunks)e2e/react-start/basic-cloudflare/vite.config.ts(1 hunks)e2e/react-start/basic-cloudflare/wrangler.jsonc(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript in strict mode with extensive type safety across the codebase
Files:
e2e/react-start/basic-cloudflare/src/router.tsxe2e/react-start/basic-cloudflare/src/utils/seo.tse2e/react-start/basic-cloudflare/src/components/DefaultCatchBoundary.tsxe2e/react-start/basic-cloudflare/src/components/NotFound.tsxe2e/react-start/basic-cloudflare/tests/app.spec.tse2e/react-start/basic-cloudflare/tests/setup/global.teardown.tse2e/react-start/basic-cloudflare/src/routes/__root.tsxe2e/react-start/basic-cloudflare/src/routeTree.gen.tse2e/react-start/basic-cloudflare/src/routes/index.tsxe2e/react-start/basic-cloudflare/tests/setup/global.setup.tse2e/react-start/basic-cloudflare/playwright.config.tse2e/react-start/basic-cloudflare/vite.config.ts
e2e/**
📄 CodeRabbit inference engine (AGENTS.md)
Store end-to-end tests under the e2e/ directory
Files:
e2e/react-start/basic-cloudflare/src/router.tsxe2e/react-start/basic-cloudflare/src/styles/app.csse2e/react-start/basic-cloudflare/src/utils/seo.tse2e/react-start/basic-cloudflare/src/components/DefaultCatchBoundary.tsxe2e/react-start/basic-cloudflare/src/components/NotFound.tsxe2e/react-start/basic-cloudflare/tests/app.spec.tse2e/react-start/basic-cloudflare/wrangler.jsonce2e/react-start/basic-cloudflare/tests/setup/global.teardown.tse2e/react-start/basic-cloudflare/src/routes/__root.tsxe2e/react-start/basic-cloudflare/src/routeTree.gen.tse2e/react-start/basic-cloudflare/public/site.webmanifeste2e/react-start/basic-cloudflare/src/routes/index.tsxe2e/react-start/basic-cloudflare/postcss.config.mjse2e/react-start/basic-cloudflare/tailwind.config.mjse2e/react-start/basic-cloudflare/tsconfig.jsone2e/react-start/basic-cloudflare/package.jsone2e/react-start/basic-cloudflare/tests/setup/global.setup.tse2e/react-start/basic-cloudflare/playwright.config.tse2e/react-start/basic-cloudflare/vite.config.ts
**/src/routes/**
📄 CodeRabbit inference engine (AGENTS.md)
Place file-based routes under src/routes/ directories
Files:
e2e/react-start/basic-cloudflare/src/routes/__root.tsxe2e/react-start/basic-cloudflare/src/routes/index.tsx
**/package.json
📄 CodeRabbit inference engine (AGENTS.md)
Use workspace:* protocol for internal dependencies in package.json files
Files:
e2e/react-start/basic-cloudflare/package.json
🧠 Learnings (4)
📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR PR: TanStack/router#0 File: AGENTS.md:0-0 Timestamp: 2025-09-23T17:36:12.598Z Learning: Applies to packages/{router-cli,router-generator,router-plugin,virtual-file-routes}/** : Keep CLI, generators, bundler plugins, and virtual file routing utilities in their dedicated tooling package directoriesApplied to files:
e2e/react-start/basic-cloudflare/.prettierignore
📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR PR: TanStack/router#0 File: AGENTS.md:0-0 Timestamp: 2025-09-23T17:36:12.598Z Learning: Applies to e2e/** : Store end-to-end tests under the e2e/ directoryApplied to files:
e2e/react-start/basic-cloudflare/tests/app.spec.ts
📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR PR: TanStack/router#0 File: AGENTS.md:0-0 Timestamp: 2025-09-23T17:36:12.598Z Learning: Applies to packages/{react-router,solid-router}/** : Implement React and Solid bindings/components only in packages/react-router/ and packages/solid-router/Applied to files:
e2e/react-start/basic-cloudflare/src/routes/__root.tsx
📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR PR: TanStack/router#0 File: AGENTS.md:0-0 Timestamp: 2025-09-23T17:36:12.598Z Learning: Applies to **/*.{ts,tsx} : Use TypeScript in strict mode with extensive type safety across the codebaseApplied to files:
e2e/react-start/basic-cloudflare/tsconfig.json
🧬 Code graph analysis (10)
e2e/react-start/basic-cloudflare/src/router.tsx (4)
e2e/react-start/basic-cloudflare/src/components/DefaultCatchBoundary.tsx (1)
DefaultCatchBoundary(10-53)
e2e/react-start/basic-cloudflare/src/components/NotFound.tsx (1)
NotFound(3-25)
e2e/react-start/server-routes/src/router.tsx (1)
createRouter(6-16)
e2e/react-start/server-functions/src/router.tsx (1)
createRouter(6-21)
e2e/react-start/basic-cloudflare/src/utils/seo.ts (1)
scripts/llms-generate.mjs (1)
title(96-96)
e2e/react-start/basic-cloudflare/src/components/DefaultCatchBoundary.tsx (3)
e2e/react-start/server-routes/src/components/DefaultCatchBoundary.tsx (1)
DefaultCatchBoundary(10-53)
e2e/solid-start/server-routes/src/components/DefaultCatchBoundary.tsx (1)
DefaultCatchBoundary(10-53)
examples/solid/start-basic/src/components/DefaultCatchBoundary.tsx (1)
DefaultCatchBoundary(10-53)
e2e/react-start/basic-cloudflare/src/components/NotFound.tsx (1)
e2e/react-start/server-routes/src/components/NotFound.tsx (1)
NotFound(3-25)
e2e/react-start/basic-cloudflare/tests/setup/global.teardown.ts (6)
e2e/react-start/basic/tests/setup/global.teardown.ts (1)
teardown(4-6)
e2e/react-router/basic-file-based-code-splitting/tests/setup/global.teardown.ts (1)
teardown(4-6)
e2e/react-start/basic-react-query/tests/setup/global.teardown.ts (1)
teardown(4-6)
e2e/react-start/scroll-restoration/tests/setup/global.teardown.ts (1)
teardown(4-6)
e2e/solid-start/basic/tests/setup/global.teardown.ts (1)
teardown(4-6)
e2e/react-router/basic-esbuild-file-based/tests/setup/global.teardown.ts (1)
teardown(4-6)
e2e/react-start/basic-cloudflare/src/routes/__root.tsx (4)
e2e/react-start/basic-cloudflare/src/routes/index.tsx (1)
Route(5-8)
e2e/react-start/basic-cloudflare/src/utils/seo.ts (1)
seo(1-33)
e2e/react-start/basic-cloudflare/src/components/DefaultCatchBoundary.tsx (1)
DefaultCatchBoundary(10-53)
e2e/react-start/basic-cloudflare/src/components/NotFound.tsx (1)
NotFound(3-25)
e2e/react-start/basic-cloudflare/src/routeTree.gen.ts (1)
e2e/react-start/basic-cloudflare/src/router.tsx (1)
getRouter(6-16)
e2e/react-start/basic-cloudflare/src/routes/index.tsx (2)
e2e/react-start/basic-cloudflare/src/routes/__root.tsx (1)
Route(15-57)
e2e/react-start/basic-cloudflare/worker-configuration.d.ts (1)
env(7814-7814)
e2e/react-start/basic-cloudflare/tests/setup/global.setup.ts (7)
e2e/solid-router/basic-file-based/tests/setup/global.setup.ts (1)
setup(4-6)
e2e/react-router/basic-file-based-code-splitting/tests/setup/global.setup.ts (1)
setup(4-6)
e2e/react-router/rspack-basic-virtual-named-export-config-file-based/tests/setup/global.setup.ts (1)
setup(4-6)
e2e/react-router/basic-virtual-file-based/tests/setup/global.setup.ts (1)
setup(4-6)
e2e/solid-router/basic-virtual-named-export-config-file-based/tests/setup/global.setup.ts (1)
setup(4-6)
e2e/solid-router/basic-file-based-code-splitting/tests/setup/global.setup.ts (1)
setup(4-6)
e2e/react-router/basic-file-based/tests/setup/global.setup.ts (1)
setup(4-6)
e2e/react-start/basic-cloudflare/playwright.config.ts (1)
scripts/set-ts-version.js (1)
packageJson(33-33)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Preview
- GitHub Check: Test
🔇 Additional comments (12)
e2e/react-start/basic-cloudflare/.gitignore (1)
1-11: Ignore patterns cover the expected Cloudflare + Playwright artifactsNothing to change here; the list neatly keeps build outputs and test artifacts out of version control.
e2e/react-start/basic-cloudflare/tests/setup/global.setup.ts (1)
1-6: LGTM – setup hooks into the shared dummy server lifecycle.This mirrors the existing e2e patterns and ensures the Cloudflare preview spins up before tests run. Nice.
e2e/react-start/basic-cloudflare/postcss.config.mjs (1)
1-6: LGTM – PostCSS stack matches the Tailwind usage.Straightforward Tailwind + Autoprefixer config, consistent with the rest of our e2e apps.
e2e/react-start/basic-cloudflare/tests/setup/global.teardown.ts (1)
1-6: LGTM – teardown cleanly stops the dummy server.Complements the global setup and keeps the test harness tidy.
e2e/react-start/basic-cloudflare/src/router.tsx (1)
1-16: LGTM – router factory matches our standard configuration.Fresh router instance per call with the expected defaults, error boundary, and not-found component.
e2e/react-start/basic-cloudflare/src/styles/app.css (1)
1-22: LGTM – base Tailwind layer aligns with the app shell.Styles mirror the other React Start examples and keep the dark/light contrast consistent.
e2e/react-start/basic-cloudflare/.prettierignore (1)
1-4: Generated artifacts excluded appropriatelyNo issues—the ignore patterns cover the generated/public assets we don't want Prettier to touch.
e2e/react-start/basic-cloudflare/wrangler.jsonc (1)
1-9: Wrangler config aligns with worker setupSettings look consistent: the compatibility flag and entrypoint match the SSR worker expectations.
e2e/react-start/basic-cloudflare/vite.config.ts (1)
1-16: Plugin stack looks correcttsconfigpaths, Cloudflare SSR, TanStack Start, and React plugins are wired in the expected order. All good.e2e/react-start/basic-cloudflare/playwright.config.ts (1)
5-30: Deterministic preview port setupDeriving the port via
getTestServerPortkeeps parallel e2e runs isolated. Nice touch.e2e/react-start/basic-cloudflare/src/components/DefaultCatchBoundary.tsx (1)
20-49: Error boundary mirrors shared patternMatches the existing React Start catch-boundary behavior, including invalidate-and-retry plus conditional back navigation. Looks good.
e2e/react-start/basic-cloudflare/tests/app.spec.ts (1)
4-18: E2E coverage hits the key Cloudflare data pathsHappy-path assertions exercise both the user agent marker and the binding value, so the worker wiring is covered.
e2e/react-start/basic-cloudflare/package.json lines 16 to 37@@ -0,0 +17,21 @@17+ "@tanstack/react-router-devtools": "workspace:^",18+ "@tanstack/react-start": "workspace:^",19+ "react": "^19.0.0",20+ "react-dom": "^19.0.0"21+ },22+ "devDependencies": {23+ "@cloudflare/vite-plugin": "^1.13.7",24+ "@playwright/test": "^1.50.1",25+ "@tanstack/router-e2e-utils": "workspace:^",26+ "@types/node": "^22.10.2",27+ "@types/react": "^19.0.8",28+ "@types/react-dom": "^19.0.3",29+ "@vitejs/plugin-react": "^4.3.4",30+ "autoprefixer": "^10.4.20",31+ "postcss": "^8.5.1",32+ "tailwindcss": "^3.4.17",33+ "typescript": "^5.7.2",34+ "vite": "^7.1.1",35+ "vite-tsconfig-paths": "^5.1.4",36+ "wrangler": "^4.40.2"37+ }🛠️ Refactor suggestion | 🟠 Major
Use
workspace:*for all internal TanStack dependencies.Per our workspace convention, internal packages should be referenced with the
workspace:*protocol, notworkspace:^. Please update both the dependencies and devDependencies entries accordingly.Apply this diff:
- "@tanstack/react-router": "workspace:^", - "@tanstack/react-router-devtools": "workspace:^", - "@tanstack/react-start": "workspace:^", + "@tanstack/react-router": "workspace:*", + "@tanstack/react-router-devtools": "workspace:*", + "@tanstack/react-start": "workspace:*", @@ - "@tanstack/router-e2e-utils": "workspace:^", + "@tanstack/router-e2e-utils": "workspace:*",📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
"@tanstack/react-router": "workspace:*", "@tanstack/react-router-devtools": "workspace:*", "@tanstack/react-start": "workspace:*", "react": "^19.0.0", "react-dom": "^19.0.0" }, "devDependencies": { "@cloudflare/vite-plugin": "^1.13.7", "@playwright/test": "^1.50.1", "@tanstack/router-e2e-utils": "workspace:*", "@types/node": "^22.10.2", "@types/react": "^19.0.8", "@types/react-dom": "^19.0.3", "@vitejs/plugin-react": "^4.3.4", "autoprefixer": "^10.4.20", "postcss": "^8.5.1", "tailwindcss": "^3.4.17", "typescript": "^5.7.2", "vite": "^7.1.1", "vite-tsconfig-paths": "^5.1.4", "wrangler": "^4.40.2" }🤖 Prompt for AI Agents
In e2e/react-start/basic-cloudflare/package.json around lines 16 to 37, update internal TanStack package references to use the workspace:* protocol instead of workspace:^; specifically change "@tanstack/react-router", "@tanstack/react-router-devtools", and "@tanstack/react-start" in "dependencies" and "@tanstack/router-e2e-utils" in "devDependencies" to "workspace:*" (and apply the same change for any other @tanstack/* entries in this range).e2e/react-start/basic-cloudflare/src/routes/__root.tsx lines 61 to 82@@ -0,0 +62,21 @@62+ <head>63+ <HeadContent />64+ </head>65+ <body>66+ <div className="p-2 flex gap-2 text-lg">67+ <Link68+ to="/"69+ activeProps={{70+ className: 'font-bold',71+ }}72+ activeOptions={{ exact: true }}73+ >74+ Home75+ </Link>76+ </div>77+ <hr />78+ {children}79+ <TanStackRouterDevtools position="bottom-right" />80+ <Scripts />81+ </body>82+ </html>⚠️ Potential issue | 🟠 Major
Add the document language attribute.
<html>without alangfails WCAG 2.1 level A, so screen readers don’t know what locale to use. Please set the appropriate language (e.g."en").- <html> + <html lang="en">📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<html lang="en"> <head> <HeadContent /> </head> <body> <div className="p-2 flex gap-2 text-lg"> <Link to="/" activeProps={{ className: 'font-bold', }} activeOptions={{ exact: true }} > Home </Link> </div> <hr /> {children} <TanStackRouterDevtools position="bottom-right" /> <Scripts /> </body> </html>🤖 Prompt for AI Agents
In e2e/react-start/basic-cloudflare/src/routes/__root.tsx around lines 61 to 82, the top-level <html> element is missing a lang attribute which fails WCAG; update the <html> tag to include an appropriate language attribute (e.g. lang="en") or derive it from your app/locale config and ensure it is set on the rendered <html> element so screen readers receive the correct document language.e2e/react-start/basic-cloudflare/src/routes/index.tsx line 3@@ -0,0 +1,3 @@1+import { createFileRoute } from '@tanstack/react-router'2+import { createServerFn } from '@tanstack/react-start'3+import { env } from 'cloudflare:workers'⚠️ Potential issue | 🔴 Critical
Avoid importing
cloudflare:workersin the shared route module.This file is bundled for the browser as well as the worker. Pulling in
cloudflare:workersat the top level causes the client build to fail because that virtual module only exists in the Cloudflare Worker runtime. Keep the import inside the server-only handler (or use the server context) so the browser bundle never tries to resolve it.Apply this diff to confine the import to the server handler:
-import { env } from 'cloudflare:workers' - const getData = createServerFn().handler(async () => { + const { env } = await import('cloudflare:workers') return { message: `Running in ${navigator.userAgent}`, myVar: env.MY_VAR, } })🤖 Prompt for AI Agents
In e2e/react-start/basic-cloudflare/src/routes/index.tsx around line 3, importing the virtual module 'cloudflare:workers' at the top-level causes the browser bundle to fail because that module only exists in the Worker runtime; move the import (or access env via the server-only context) inside the server-only handler so the client build never tries to resolve it—remove the top-level import and require or import env within the worker/loader function (or use the server runtime API) and reference it only inside code guarded for server execution.e2e/react-start/basic-cloudflare/src/utils/seo.ts lines 20 to 28@@ -0,0 +8,21 @@8+ description?: string9+ image?: string10+ keywords?: string11+}) => {12+ const tags = [13+ { title },14+ { name: 'description', content: description },15+ { name: 'keywords', content: keywords },16+ { name: 'twitter:title', content: title },17+ { name: 'twitter:description', content: description },18+ { name: 'twitter:creator', content: '@tannerlinsley' },19+ { name: 'twitter:site', content: '@tannerlinsley' },20+ { name: 'og:type', content: 'website' },21+ { name: 'og:title', content: title },22+ { name: 'og:description', content: description },23+ ...(image24+ ? [25+ { name: 'twitter:image', content: image },26+ { name: 'twitter:card', content: 'summary_large_image' },27+ { name: 'og:image', content: image },28+ ]⚠️ Potential issue | 🟠 Major
Fix Open Graph meta attributes
On Line 20 and the surrounding OG entries we’re using
name="og:*"instead ofproperty="og:*". Open Graph parsers ignorename, so the tags will not be picked up. Please swap these toproperty.- { name: 'og:type', content: 'website' }, - { name: 'og:title', content: title }, - { name: 'og:description', content: description }, + { property: 'og:type', content: 'website' }, + { property: 'og:title', content: title }, + { property: 'og:description', content: description }, @@ - { name: 'og:image', content: image }, + { property: 'og:image', content: image },📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
{ property: 'og:type', content: 'website' }, { property: 'og:title', content: title }, { property: 'og:description', content: description }, ...(image ? [ { name: 'twitter:image', content: image }, { name: 'twitter:card', content: 'summary_large_image' }, { property: 'og:image', content: image }, ]🤖 Prompt for AI Agents
e2e/react-start/basic-cloudflare/src/utils/seo.ts around lines 20 to 28: the Open Graph meta entries currently use name="og:*" which Open Graph parsers ignore; change those entries to use property="og:type", property="og:title", property="og:description" and property="og:image" (leave the twitter:* tags using name as-is) so OG tags are recognized by parsers.- e2e/react-start/basic-cloudflare/tests/app.spec.ts line 7Outdated@@ -0,0 +1,7 @@1+import { expect } from '@playwright/test'2+import { test } from '@tanstack/router-e2e-utils'3+4+test('returns the correct user agent', async ({ page }) => {5+ await page.goto('/')6+7+ await expect(page.locator('p').nth(0)).toHaveText(
please use data-testid instead of locator to make those tests simpler and more robust to changes
schiller-manuel(GitHub profile, opens in a new tab) requested changes
e2e/react-start/basic-cloudflare/tests/app.spec.ts line 17Outdated@@ -0,0 +1,17 @@1+import { expect } from '@playwright/test'2+import { test } from '@tanstack/router-e2e-utils'3+4+test('returns the correct user agent', async ({ page }) => {5+ await page.goto('/')6+7+ await expect(page.locator('p').nth(0)).toHaveText(8+ 'Running in Cloudflare-Workers',9+ )10+})11+12+test('returns the correct value from a Cloudflare binding', async ({13+ page,14+}) => {15+ await page.goto('/')16+17+ await expect(page.locator('p').nth(1)).toHaveText('Hello from Cloudflare')please use data-testid instead of locator to make those tests simpler and more robust to changes
schiller-manuel(GitHub profile, opens in a new tab) approved these changes
Sign in to join this conversation.
Walkthrough#
Adds a new e2e React Start example for Cloudflare Workers: project scaffolding, Vite/Cloudflare/Tailwind/PostCSS configs, TanStack Router setup and generated route tree, UI components and utilities, Playwright E2E tests with global setup/teardown, and Cloudflare Wrangler config with a MY_VAR binding.
Changes#
e2e/react-start/basic-cloudflare/.gitignore,e2e/react-start/basic-cloudflare/.prettierignore,e2e/react-start/basic-cloudflare/package.json,e2e/react-start/basic-cloudflare/postcss.config.mjs,e2e/react-start/basic-cloudflare/tailwind.config.mjs,e2e/react-start/basic-cloudflare/tsconfig.json,e2e/react-start/basic-cloudflare/vite.config.ts,e2e/react-start/basic-cloudflare/wrangler.jsonce2e/react-start/basic-cloudflare/public/site.webmanifest,e2e/react-start/basic-cloudflare/src/styles/app.csse2e/react-start/basic-cloudflare/src/router.tsx,e2e/react-start/basic-cloudflare/src/routeTree.gen.ts,e2e/react-start/basic-cloudflare/src/routes/__root.tsx,e2e/react-start/basic-cloudflare/src/routes/index.tsx,e2e/react-start/basic-cloudflare/src/utils/seo.tse2e/react-start/basic-cloudflare/src/components/DefaultCatchBoundary.tsx,e2e/react-start/basic-cloudflare/src/components/NotFound.tsxe2e/react-start/basic-cloudflare/playwright.config.ts,e2e/react-start/basic-cloudflare/tests/app.spec.ts,e2e/react-start/basic-cloudflare/tests/setup/global.setup.ts,e2e/react-start/basic-cloudflare/tests/setup/global.teardown.tsSequence Diagram(s)#
Estimated code review effort#
🎯 3 (Moderate) | ⏱️ ~25–30 minutes
Possibly related issues#
Possibly related PRs#
vite.config.ts.getRouter) used here.Suggested labels#
package: react-startSuggested reviewers#
Poem#
Pre-merge checks and finishing touches#
❌ Failed checks (1 warning)
@coderabbitai generate docstringsto improve docstring coverage.✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between b1ce9f8cb8b67af251361315a962e4b695ea9e9e and 1af5aefa58bdec79579804c21abe242ca442d606.
📒 Files selected for processing (2)
e2e/react-start/basic-cloudflare/src/routes/index.tsx(1 hunks)e2e/react-start/basic-cloudflare/tests/app.spec.ts(1 hunks)🚧 Files skipped from review as they are similar to previous changes (2)
Comment `@coderabbitai help` to get the list of available commands and usage tips.