Skip to content

Commit 2482cb2

Browse files
committed
fix: handle undefined TSS_PRERENDABLE_PATHS in prerender function
1 parent e5f1772 commit 2482cb2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/start-plugin-core/src/global.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import type { Manifest } from '@tanstack/router-core'
33
/* eslint-disable no-var */
44
declare global {
55
var TSS_ROUTES_MANIFEST: Manifest
6-
var TSS_PRERENDABLE_PATHS: Array<{ path: string }>
6+
var TSS_PRERENDABLE_PATHS: Array<{ path: string }> | undefined
77
}
88
export {}

packages/start-plugin-core/src/prerender.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ export async function prerender({
2828

2929
if (startConfig.prerender.autoStaticPathsDiscovery ?? true) {
3030
// merge discovered static pages with user-defined pages
31-
const pagesMap = new Map(pages.map((item) => [item.path, item]))
31+
const pagesMap = new Map(pages.map(item => [item.path, item]));
32+
const discoveredPages = globalThis.TSS_PRERENDABLE_PATHS || [];
3233

33-
for (const page of globalThis.TSS_PRERENDABLE_PATHS) {
34+
for (const page of discoveredPages) {
3435
if (!pagesMap.has(page.path)) {
3536
pagesMap.set(page.path, page)
3637
}

0 commit comments

Comments
 (0)