Skip to content

Commit 0f7f08c

Browse files
committed
fix: upload prerendered shells
1 parent 04c7034 commit 0f7f08c

File tree

2 files changed

+41
-11
lines changed

2 files changed

+41
-11
lines changed

src/build/content/prerendered.ts

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -238,17 +238,30 @@ export const copyPrerenderedContent = async (ctx: PluginContext): Promise<void>
238238
}
239239
}),
240240
),
241-
...ctx.getFallbacks(manifest).map(async (route) => {
242-
const key = routeToFilePath(route)
243-
const value = await buildPagesCacheValue(
244-
join(ctx.publishDir, 'server/pages', key),
245-
undefined,
246-
shouldUseEnumKind,
247-
true, // there is no corresponding json file for fallback, so we are skipping it for this entry
248-
)
249-
250-
await writeCacheEntry(key, value, Date.now(), ctx)
251-
}),
241+
...ctx.getFallbacks(manifest).map((route) =>
242+
limitConcurrentPrerenderContentHandling(async () => {
243+
const key = routeToFilePath(route)
244+
const value = await buildPagesCacheValue(
245+
join(ctx.publishDir, 'server/pages', key),
246+
undefined,
247+
shouldUseEnumKind,
248+
true, // there is no corresponding json file for fallback, so we are skipping it for this entry
249+
)
250+
251+
await writeCacheEntry(key, value, Date.now(), ctx)
252+
}),
253+
),
254+
...ctx.getShells(manifest).map((route) =>
255+
limitConcurrentPrerenderContentHandling(async () => {
256+
const key = routeToFilePath(route)
257+
const value = await buildAppCacheValue(
258+
join(ctx.publishDir, 'server/app', key),
259+
shouldUseAppPageKind,
260+
)
261+
262+
await writeCacheEntry(key, value, Date.now(), ctx)
263+
}),
264+
),
252265
])
253266

254267
// app router 404 pages are not in the prerender manifest

src/build/plugin-context.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,23 @@ export class PluginContext {
392392
return this.#fallbacks
393393
}
394394

395+
#shells: string[] | null = null
396+
getShells(prerenderManifest: PrerenderManifest): string[] {
397+
if (!this.#shells) {
398+
this.#shells = Object.entries(prerenderManifest.dynamicRoutes).reduce(
399+
(shells, [route, meta]) => {
400+
if (meta.renderingMode === 'PARTIALLY_STATIC') {
401+
shells.push(route)
402+
}
403+
return shells
404+
},
405+
[] as string[],
406+
)
407+
}
408+
409+
return this.#shells
410+
}
411+
395412
#fullyStaticHtmlPages: string[] | null = null
396413
/**
397414
* Get an array of fully static pages router pages (no `getServerSideProps` or `getStaticProps`).

0 commit comments

Comments
 (0)