{"record":{"id":"2a92b707795fbfe2","repo":"anomalyco/sst","slug":"found-basename-configured-in-react-router-config","errorCode":null,"errorMessage":"Found \"basename\" configured in react-router.config.ts but missing \"base\" in vite.config.ts. Both configurations are required.","messagePattern":"Found \"basename\" configured in react-router\\.config\\.ts but missing \"base\" in vite\\.config\\.ts\\. Both configurations are required\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/react.ts","lineNumber":449,"sourceCode":"      })();\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          ? (() => {\n            // React does perform their own internal ESBuild process, but it doesn't bundle\n            // 3rd party dependencies by default. In the interest of keeping deployments\n            // seamless for users we will create a server bundle with all dependencies included.\n\n            fs.copyFileSync(\n              path.join(\n                $cli.paths.platform,\n                \"functions\",\n                \"react-server\",\n                \"server.mjs\",","sourceCodeStart":431,"sourceCodeEnd":467,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/react.ts#L431-L467","documentation":"The inverse pairing check: a basename in react-router.config.ts without a corresponding base in vite.config.ts throws this Error, since the component requires both configurations to be set together.","triggerScenarios":"reactRouterBase is truthy in react-router.config.ts while viteBase is falsy in vite.config.ts during buildPlan.","commonSituations":"Upgrading a React Router framework app that sets basename but whose vite.config.ts lacks base; partially applying a config change across the two files.","solutions":["Add a matching base: \"/app/\" (with trailing slash) to vite.config.ts","Ensure the two values correspond (basename \"/app\" ↔ base \"/app/\")","Or remove basename if no custom base path is needed"],"exampleFix":"// vite.config.ts before\nexport default {};\n// after\nexport default { base: \"/app/\" };","handlingStrategy":"validation","validationCode":"if (basename && !viteBase) throw new Error(\"base required in vite.config.ts when react-router basename is set\");","typeGuard":null,"tryCatchPattern":"try {\n  new sst.aws.React(\"Web\", args);\n} catch (e) {\n  if (String(e).includes(\"missing \\\"base\\\"\")) console.error(\"Add matching base to vite.config.ts\");\n  throw e;\n}","preventionTips":["Add base to vite.config.ts whenever basename is set in react-router.config.ts","Keep the pair in sync (base \"/app/\" ↔ basename \"/app\")","Review both config files together during upgrades to React Router framework mode"],"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"}