[next] Ensure app functions are detected/separated properly (#9989)

Follow-up to https://github.com/vercel/vercel/pull/9974 this uses the `lambdaAppPaths` as the source of truth instead of the manifest which is more accurate for separating/detecting. Also adds additional test cases for new root and index app functions. 

x-ref: https://github.com/vercel/next.js/issues/49169
This commit is contained in:
JJ Kasper
2023-05-19 09:22:44 -07:00
committed by GitHub
parent 6cdd38d130
commit f00b08a820
5 changed files with 18 additions and 8 deletions

View File

@@ -0,0 +1,5 @@
---
"@vercel/next": patch
---
[next] Ensure app functions are detected/separated properly

View File

@@ -407,14 +407,10 @@ export async function serverBuild({
dynamicPages.push(normalizedPathname); dynamicPages.push(normalizedPathname);
} }
if (pageMatchesApi(page)) { if (lambdaAppPaths[page]) {
apiPages.push(page);
} else if (
(appPathRoutesManifest?.[`${normalizedPathname}/page`] ||
appPathRoutesManifest?.[`${normalizedPathname}/route`]) &&
lambdaAppPaths[page]
) {
appRouterPages.push(page); appRouterPages.push(page);
} else if (pageMatchesApi(page)) {
apiPages.push(page);
} else { } else {
nonApiPages.push(page); nonApiPages.push(page);
} }

View File

@@ -1,3 +1,5 @@
export const dynamic = 'force-dynamic'
export default function HelloPage(props) { export default function HelloPage(props) {
return ( return (
<> <>

View File

@@ -1,3 +1,5 @@
export const dynamic = 'force-dynamic'
export default function Page() { export default function Page() {
return <p>index app page</p>; return <p>index app page {Date.now()}</p>;
} }

View File

@@ -18,6 +18,11 @@
} }
], ],
"probes": [ "probes": [
{
"path": "/dashboard/hello",
"status": 200,
"mustContain": "hello from app/dashboard/rootonly/hello"
},
{ {
"path": "/dashboard/another-edge", "path": "/dashboard/another-edge",
"status": 200, "status": 200,