Skip to content

Commit 7764e32

Browse files
committed
fix: add some more html files
1 parent 4aca054 commit 7764e32

File tree

1 file changed

+24
-17
lines changed

1 file changed

+24
-17
lines changed

packages/runtime/src/helpers/functions.ts

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -311,24 +311,27 @@ const changeExtension = (file: string, extension: string) => {
311311
const getSSRDependencies = async (publish: string): Promise<string[]> => {
312312
const prerenderManifest: PrerenderManifest = await readJSON(join(publish, 'prerender-manifest.json'))
313313

314-
return Object.entries(prerenderManifest.routes).flatMap(([route, ssgRoute]) => {
315-
if (ssgRoute.initialRevalidateSeconds === false) {
316-
return []
317-
}
314+
return [
315+
...Object.entries(prerenderManifest.routes).flatMap(([route, ssgRoute]) => {
316+
if (ssgRoute.initialRevalidateSeconds === false) {
317+
return []
318+
}
319+
320+
if (ssgRoute.dataRoute.endsWith('.rsc')) {
321+
return [
322+
join(publish, 'server', 'app', ssgRoute.dataRoute),
323+
join(publish, 'server', 'app', changeExtension(ssgRoute.dataRoute, '.html')),
324+
]
325+
}
318326

319-
if (ssgRoute.dataRoute.endsWith('.rsc')) {
327+
const trimmedPath = route === '/' ? 'index' : route.slice(1)
320328
return [
321-
join(publish, 'server', 'app', ssgRoute.dataRoute),
322-
join(publish, 'server', 'app', changeExtension(ssgRoute.dataRoute, '.html')),
329+
join(publish, 'server', 'pages', `${trimmedPath}.html`),
330+
join(publish, 'server', 'pages', `${trimmedPath}.json`),
323331
]
324-
}
325-
326-
const trimmedPath = route === '/' ? 'index' : route.slice(1)
327-
return [
328-
join(publish, 'server', 'pages', `${trimmedPath}.html`),
329-
join(publish, 'server', 'pages', `${trimmedPath}.json`),
330-
]
331-
})
332+
}),
333+
join(publish, '**', '*.html'),
334+
]
332335
}
333336

334337
export const getSSRLambdas = async (publish: string, baseDir: string): Promise<SSRLambda[]> => {
@@ -344,12 +347,16 @@ export const getSSRLambdas = async (publish: string, baseDir: string): Promise<S
344347
return [
345348
{
346349
functionName: HANDLER_FUNCTION_NAME,
347-
includedFiles: [...commonDependencies, ...nonOdbRoutes.flatMap((route) => route.includedFiles)],
350+
includedFiles: [
351+
...commonDependencies,
352+
...ssrDependencies,
353+
...nonOdbRoutes.flatMap((route) => route.includedFiles),
354+
],
348355
routes: nonOdbRoutes,
349356
},
350357
{
351358
functionName: ODB_FUNCTION_NAME,
352-
includedFiles: [...commonDependencies, ...odbRoutes.flatMap((route) => route.includedFiles), ...ssrDependencies],
359+
includedFiles: [...commonDependencies, ...ssrDependencies, ...odbRoutes.flatMap((route) => route.includedFiles)],
353360
routes: odbRoutes,
354361
},
355362
]

0 commit comments

Comments
 (0)