@@ -311,24 +311,27 @@ const changeExtension = (file: string, extension: string) => {
311
311
const getSSRDependencies = async ( publish : string ) : Promise < string [ ] > => {
312
312
const prerenderManifest : PrerenderManifest = await readJSON ( join ( publish , 'prerender-manifest.json' ) )
313
313
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
+ }
318
326
319
- if ( ssgRoute . dataRoute . endsWith ( '.rsc' ) ) {
327
+ const trimmedPath = route === '/' ? 'index' : route . slice ( 1 )
320
328
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` ) ,
323
331
]
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
+ ]
332
335
}
333
336
334
337
export const getSSRLambdas = async ( publish : string , baseDir : string ) : Promise < SSRLambda [ ] > => {
@@ -344,12 +347,16 @@ export const getSSRLambdas = async (publish: string, baseDir: string): Promise<S
344
347
return [
345
348
{
346
349
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
+ ] ,
348
355
routes : nonOdbRoutes ,
349
356
} ,
350
357
{
351
358
functionName : ODB_FUNCTION_NAME ,
352
- includedFiles : [ ...commonDependencies , ...odbRoutes . flatMap ( ( route ) => route . includedFiles ) , ... ssrDependencies ] ,
359
+ includedFiles : [ ...commonDependencies , ...ssrDependencies , ... odbRoutes . flatMap ( ( route ) => route . includedFiles ) ] ,
353
360
routes : odbRoutes ,
354
361
} ,
355
362
]
0 commit comments