diff --git a/package.json b/package.json index 6aa762178..9907442a7 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,6 @@ "url": "https://github.com/tervay/recalc.git" }, "type": "module", - "packageManager": "pnpm@11.15.0", "scripts": { "build": "react-router build", "build:wpi": "./wpilib/build.sh", @@ -92,5 +91,6 @@ }, "engines": { "node": ">=24" - } + }, + "packageManager": "pnpm@11.15.0" } diff --git a/vite.config.ts b/vite.config.ts index 9b00fd480..c376e5b2e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,4 +1,3 @@ -import fs from 'node:fs'; import path from 'path'; import { reactRouter } from '@react-router/dev/vite'; @@ -8,25 +7,11 @@ import { comlink } from 'vite-plugin-comlink'; import Sitemap from 'vite-plugin-sitemap'; import { defineConfig } from 'vitest/config'; -// Dev-only routes that should never be indexed or listed in the sitemap. -const EXCLUDED_ROUTES = ['/dev/error']; - -function routesFromConfig(): string[] { - const src = fs.readFileSync( - path.resolve(__dirname, 'app/routes.ts'), - 'utf-8', - ); - // The home page is declared with `index(...)`, not `route(...)`, so seed it - // explicitly; the regex below only captures `route(...)` entries. - const paths: string[] = ['/']; - for (const match of src.matchAll(/^\s*route\(\s*['"]([^'"]+)['"]/gm)) { - const routePath = `/${match[1]}`; - if (!EXCLUDED_ROUTES.includes(routePath)) paths.push(routePath); - } - return paths; -} - -const routes = routesFromConfig(); +// The sitemap plugin auto-discovers every prerendered route by globbing the +// built HTML in `build/client`, so we only need to exclude non-public pages +// that still emit HTML. `/dev/error` isn't prerendered, so it never appears; +// `/__spa-fallback` is React Router's client fallback shell, not a real page. +const EXCLUDED_ROUTES = ['/__spa-fallback', '/dev/error']; export default defineConfig({ plugins: [ @@ -39,7 +24,7 @@ export default defineConfig({ }), Sitemap({ hostname: 'https://reca.lc', - dynamicRoutes: routes, + exclude: EXCLUDED_ROUTES, generateRobotsTxt: true, robots: [ {