{"record":{"id":"a42b4926c64ea04a","repo":"anomalyco/sst","slug":"found-base-configured-in-vite-config-ts-but-miss","errorCode":null,"errorMessage":"Found \"base\" configured in vite.config.ts but missing \"basename\" in react-router.config.ts. Both configurations are required.","messagePattern":"Found \"base\" configured in vite\\.config\\.ts but missing \"basename\" in react-router\\.config\\.ts\\. Both configurations are required\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/react.ts","lineNumber":439,"sourceCode":"      })();\n\n      // Get base configured in react-router config ie. \"/docs/\"\n      const reactRouterBase = (() => {\n        try {\n          const rrConfig = path.join(outputPath, \"react-router.config.ts\");\n          const content = fs.readFileSync(rrConfig, \"utf-8\");\n          const match = content.match(/[\"']?basename[\"']?:\\s*[\"']([^\"]+)[\"']/);\n          return match ? match[1] : undefined;\n        } catch (e) { }\n      })();\n\n      if (viteBase) {\n        if (!viteBase.endsWith(\"/\"))\n          throw new Error(\n            `The \"base\" value in vite.config.ts must end with a trailing slash (\"/\"). This is required for correct asset path construction.`,\n          );\n        if (!reactRouterBase)\n          throw new Error(\n            `Found \"base\" configured in vite.config.ts but missing \"basename\" in react-router.config.ts. Both configurations are required.`,\n          );\n      }\n      if (reactRouterBase) {\n        if (reactRouterBase.endsWith(\"/\"))\n          throw new Error(\n            `The \"basename\" value in react-router.config.ts must not end with a trailing slash (\"/\"). This ensures the root URL is accessible without a trailing slash.`,\n          );\n        if (!viteBase)\n          throw new Error(\n            `Found \"basename\" configured in react-router.config.ts but missing \"base\" in vite.config.ts. Both configurations are required.`,\n          );\n      }\n\n      return {\n        base: reactRouterBase,\n        server: serverPath\n          ? (() => {","sourceCodeStart":421,"sourceCodeEnd":457,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/react.ts#L421-L457","documentation":"React Router (v7/framework mode) requires a matching basename in react-router.config.ts when vite.config.ts sets a base. The component validates both are set together; a vite base without a react-router basename throws this Error.","triggerScenarios":"viteBase is present (truthy) in vite.config.ts while reactRouterBase is missing/falsy in react-router.config.ts during buildPlan.","commonSituations":"Adding base for CDN/asset prefixing but forgetting basename; teams unaware both files must agree when using React Router framework mode.","solutions":["Add basename: \"/app\" (matching the vite base, no trailing slash) to react-router.config.ts","Keep both values consistent (base \"/app/\" ↔ basename \"/app\")","If base isn't needed, remove it from vite.config.ts"],"exampleFix":"// react-router.config.ts before\nexport default {};\n// after\nexport default { basename: \"/app\" };","handlingStrategy":"validation","validationCode":"if (viteBase && !basename) throw new Error(\"basename required in react-router.config.ts when vite base is set\");","typeGuard":null,"tryCatchPattern":"try {\n  new sst.aws.React(\"Web\", args);\n} catch (e) {\n  if (String(e).includes(\"missing \\\"basename\\\"\")) console.error(\"Add matching basename to react-router.config.ts\");\n  throw e;\n}","preventionTips":["Treat vite base and react-router basename as a pair — change both together","basename \"/app\" must match base \"/app/\"","Add a CI check that greps both configs when either is present"],"tags":["vite","react-router","asset-paths","configuration"],"backgroundTag":"config-validation-failed","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}