Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions packages/start-plugin-core/src/prerender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,17 +207,28 @@ export async function prerender({
const contentType = res.headers.get('content-type') || ''
const isImplicitHTML =
!cleanPagePath.endsWith('.html') && contentType.includes('html')
// &&
// !JsonSigRx.test(dataBuff.subarray(0, 32).toString('utf8'))

const routeWithIndex = cleanPagePath.endsWith('/')
? cleanPagePath + 'index'
: cleanPagePath

const htmlPath =
cleanPagePath.endsWith('/') ||
(prerenderOptions.autoSubfolderIndex ?? true)
? joinURL(cleanPagePath, 'index.html')
: cleanPagePath + '.html'
const isSpaShell =
startConfig.spa?.prerender.outputPath === cleanPagePath

let htmlPath: string
if (isSpaShell) {
// For SPA shell, ignore autoSubfolderIndex option
htmlPath = cleanPagePath + '.html'
} else {
if (
cleanPagePath.endsWith('/') ||
(prerenderOptions.autoSubfolderIndex ?? true)
) {
htmlPath = joinURL(cleanPagePath, 'index.html')
} else {
htmlPath = cleanPagePath + '.html'
}
}

const filename = withoutBase(
isImplicitHTML ? htmlPath : routeWithIndex,
Expand Down
Loading