mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-10 04:22:12 +00:00
[next] App Pages Prerender Manifest Update (#10978)
Previously routes that did not have a `dataRoute` key in the `prerender-manifest.json` would be treated as an App Route. The logic has been updated (for partial prerendering support) to also consider the new `prefetchDataRoute`. Entries with either of these keys are treated as an App Page instead of an App Route. This also addressed the scenerio where a app route (`route.ts`) with a dynamic segment (`/api/[slug]/route.ts`) which doesn't emit a `.body` during build doesn't cause the build to fail by checking for the file first.
This commit is contained in:
@@ -2108,14 +2108,22 @@ export const onPrerenderRoute =
|
||||
} else if (
|
||||
appDir &&
|
||||
!dataRoute &&
|
||||
!prefetchDataRoute &&
|
||||
isAppPathRoute &&
|
||||
!(isBlocking || isFallback)
|
||||
) {
|
||||
const contentType = initialHeaders?.['content-type'];
|
||||
htmlFsRef = new FileFsRef({
|
||||
fsPath: path.join(appDir, `${routeFileNoExt}.body`),
|
||||
contentType: contentType || 'text/html;charset=utf-8',
|
||||
});
|
||||
|
||||
// If the route has a body file, use it as the fallback, otherwise it may
|
||||
// not have an associated fallback. This could be the case for routes that
|
||||
// have dynamic segments.
|
||||
const fsPath = path.join(appDir, `${routeFileNoExt}.body`);
|
||||
if (fs.existsSync(fsPath)) {
|
||||
htmlFsRef = new FileFsRef({
|
||||
fsPath,
|
||||
contentType: contentType || 'text/html;charset=utf-8',
|
||||
});
|
||||
}
|
||||
} else {
|
||||
htmlFsRef =
|
||||
isBlocking || (isNotFound && !static404Page)
|
||||
|
||||
Reference in New Issue
Block a user