-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Description
Which project does this relate to?
Start
Describe the bug
When configuring a custom base path in Vite along with TanStack Router's basepath, the prerenderer still attempts to crawl from / instead of the configured base path, resulting in a "Failed to fetch /: Not Found" error during build.
Your Example Website or App
https://github.com/busy-dog/tanstack-start-demo
Steps to Reproduce the Bug or Issue
- Configure a custom base path in vite.config.ts:
const BASEPATH = '/gitlab/34e28e1e78c44601b0974c2097b85a27/caelum-doc-dist/';
export default defineConfig({
base: BASEPATH,
define: {
BASEPATH: JSON.stringify(BASEPATH),
},
plugins: [
tanstackStart({
spa: {
enabled: true,
prerender: {
outputPath: 'index.html',
enabled: true,
crawlLinks: false,
},
},
pages: [
{ path: `/docs` },
{ path: `/api/search` },
],
}),
],
});- Configure router with basepath in router.tsx:
export function getRouter() {
return createTanStackRouter({
routeTree,
basepath: BASEPATH,
// ... other options
});
}- Run vite build
Build fails during prerender phase with:
[prerender] Crawling: /
error: Failed to fetch /: Not Found
at <anonymous> (/node_modules/@tanstack/start-plugin-core/dist/esm/prerender.js:126:23)Expected behavior
The prerenderer should respect the configured base path and attempt to fetch from /gitlab/34e28e1e78c44601b0974c2097b85a27/caelum-doc-dist/ instead of /.
Screenshots or Videos
No response
Platform
- Router / Start Version: 1.139.14
- OS: macOS
- Browser: Chrome
- Browser Version: 141
- Bundler: vite
- Bundler Version: 7.2.6
Additional context
No response
busy-dogbusy-dog
Metadata
Metadata
Assignees
Labels
No labels