@@ -173,23 +173,22 @@ export function createCacheAssets(options: buildHelper.BuildOptions) {
173173 logger . warn ( `Skipping invalid cache file: ${ cacheFilePath } ` ) ;
174174 return ;
175175 }
176- const segments : Record < string , string > = { } ;
177176
178177 // If we have a meta file, and it contains segmentPaths, we need to add them to the cache file
179- if (
180- cacheFileMeta &&
181- Array . isArray ( cacheFileMeta . segmentPaths ) &&
182- cacheFileMeta . segmentPaths . length > 0
183- ) {
184- cacheFileMeta . segmentPaths . forEach ( ( segmentPath : string ) => {
185- const absoluteSegmentPath = path . join (
186- files . meta ! . replace ( / \. m e t a $ / , ".segments" ) ,
187- ` ${ segmentPath } .segment.rsc` ,
188- ) ;
189- const segmentContent = fs . readFileSync ( absoluteSegmentPath , "utf8" ) ;
190- segments [ segmentPath ] = segmentContent ;
191- } ) ;
192- }
178+ const segments : Record < string , string > = Array . isArray (
179+ cacheFileMeta ?. segmentPaths ,
180+ )
181+ ? Object . fromEntries (
182+ cacheFileMeta ! . segmentPaths . map ( ( segmentPath : string ) => {
183+ const absoluteSegmentPath = path . join (
184+ files . meta ! . replace ( / \. m e t a $ / , ".segments" ) ,
185+ ` ${ segmentPath } .segment.rsc` ,
186+ ) ;
187+ const segmentContent = fs . readFileSync ( absoluteSegmentPath , "utf8" ) ;
188+ return [ segmentPath , segmentContent ] ;
189+ } ) ,
190+ )
191+ : { } ;
193192
194193 const cacheFileContent = {
195194 type : files . body ? "route" : files . json ? "page" : "app" ,
0 commit comments