TanStackT
TanStack4mo ago
4 replies
wispy-yellow

Custom vite base path causes prerender to fail in SPA mode

When setting vite's base option, I get the following error:
[prerender] Prerendering pages...
[prerender] Concurrency: 8
[prerender] Crawling: /
[prerender] Prerendered 1 pages:
[prerender] - /
[sitemap] Hint: Pages found, but no sitemap host has been set. To enable sitemap generation, set the `sitemap.host` option.
file:///Users/andriymassimilla/Projects/a2-ai/portkey/frontend/node_modules/@tanstack/start-plugin-core/dist/esm/prerender.js:109
            throw new Error(`Failed to fetch ${page.path}: ${res.statusText}`, {
                  ^

Error: Failed to fetch /: 
    at file:///Users/andriymassimilla/Projects/a2-ai/portkey/frontend/node_modules/@tanstack/start-plugin-core/dist/esm/prerender.js:109:19
    at async file:///Users/andriymassimilla/Projects/a2-ai/portkey/frontend/node_modules/@tanstack/start-plugin-core/dist/esm/queue.js:38:17 {
  [cause]: Response {}
}

Node.js v24.9.0

I can build the app if I omit the base setting from the vite config, but then the _shell.html roots at / instead of the intended custom base path:
...
manifest:$R[1]={routes:$R[2]={__root__:$R[3]={preloads:$R[4]=["/assets/main-C43l1_7D.js"]
...

any ideas?
Was this page helpful?