mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-11 04:22:13 +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:
6
.changeset/twelve-walls-provide.md
Normal file
6
.changeset/twelve-walls-provide.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
'@vercel/next': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Entries in the `prerender-manifest.json` without a `dataRoute` but with a `prefetchDataRoute` will be treated as an App Page. App Route's that do not have
|
||||||
|
a body will not cause a build error.
|
||||||
@@ -2108,14 +2108,22 @@ export const onPrerenderRoute =
|
|||||||
} else if (
|
} else if (
|
||||||
appDir &&
|
appDir &&
|
||||||
!dataRoute &&
|
!dataRoute &&
|
||||||
|
!prefetchDataRoute &&
|
||||||
isAppPathRoute &&
|
isAppPathRoute &&
|
||||||
!(isBlocking || isFallback)
|
!(isBlocking || isFallback)
|
||||||
) {
|
) {
|
||||||
const contentType = initialHeaders?.['content-type'];
|
const contentType = initialHeaders?.['content-type'];
|
||||||
htmlFsRef = new FileFsRef({
|
|
||||||
fsPath: path.join(appDir, `${routeFileNoExt}.body`),
|
// If the route has a body file, use it as the fallback, otherwise it may
|
||||||
contentType: contentType || 'text/html;charset=utf-8',
|
// 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 {
|
} else {
|
||||||
htmlFsRef =
|
htmlFsRef =
|
||||||
isBlocking || (isNotFound && !static404Page)
|
isBlocking || (isNotFound && !static404Page)
|
||||||
|
|||||||
Reference in New Issue
Block a user