SEO for a Vite or React single-page app

A Vite or Create React App build sends crawlers an empty page by default. Here are five ways to fix that, from the smallest change to the largest, and what each one costs.

Last updated 30 October 2026

First confirm that you have the problem: is my site a JavaScript shell? takes a minute. If the pages you want found are already real HTML, none of this is needed.

1. Split the marketing pages from the app

Most SaaS products only need crawlers on the homepage, pricing, features, docs and blog. The app behind the sign-in does not need indexing. Serve the public pages as plain or statically generated HTML at yourproduct.com (Astro, a static site generator, or hand-written HTML) and keep the Vite app at app.yourproduct.com or under /app. The app does not change at all, and the marketing pages become the fastest on the site.

Cost: two deployments and some shared styling. Best when: the public pages are few and change less often than the app.

2. Prerender the public routes at build time

If the site already uses React Router, its framework mode can render chosen routes to HTML at build time and still deploy as static files. Every other route falls back to the normal SPA:

// react-router.config.ts
import type { Config } from "@react-router/dev/config";

export default {
  ssr: false,                                  // still a static site
  prerender: ["/", "/pricing", "/features"],   // these get real HTML at build time
} satisfies Config;

Vike (formerly vite-plugin-ssr) offers the same for a plain Vite app. Data that changes per visitor still loads in the browser; the copy, headings and links are in the HTML.

Cost: moving to the framework’s routing and making those pages render without window. Best when: marketing and app share one codebase and you do not want a server.

3. Server-side rendering

Render every request on a server: React Router framework mode with SSR on, Next.js, Vike or TanStack Start. This covers pages whose content depends on data, such as a public profile or a template gallery with thousands of entries, where building every page ahead of time is not practical.

Cost: a server or serverless functions to run and pay for, and code that runs in both places. Best when: there are many public pages built from data.

4. A prerendering service

A proxy detects crawlers and serves them an HTML snapshot rendered by a headless browser, while visitors get the SPA. It needs no code change, but Google calls this “dynamic rendering” and describes it as “a workaround and not a long-term solution”, recommending server-side rendering, static rendering or hydration instead (Google Search Central). Snapshots can also go stale or differ from what visitors see.

Cost: a monthly fee and one more moving part. Best when: you need crawlers to see something this week and a real fix is planned.

5. Rely on Google rendering it

Google does run JavaScript, so a shell can still be indexed. But pages wait in a render queue first, and other crawlers, link previews and AI assistants mostly do not run it at all. Why Google sees an empty page goes through who sees what.

Cost: nothing now, and slower or missing coverage later. Best when: search is not a channel for you.

What does not fix it

Check the fix

After deploying, run the same check again. The audit should no longer report a JavaScript shell, and the headings, links and copy you expect should appear in its report, because they are now in the HTML.

Check your own page. The free audit fetches the HTML a crawler gets and says first if it is an empty JavaScript shell, with the byte and word counts. No sign-up, 10 pages an hour.

Related