Skip to content

Commit

Permalink
[next] Ensure app functions are detected/separated properly (#9989)
Browse files Browse the repository at this point in the history
Follow-up to #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: vercel/next.js#49169
  • Loading branch information
ijjk committed May 19, 2023
1 parent 6cdd38d commit f00b08a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/tiny-melons-bow.md
@@ -0,0 +1,5 @@
---
"@vercel/next": patch
---

[next] Ensure app functions are detected/separated properly
10 changes: 3 additions & 7 deletions packages/next/src/server-build.ts
Expand Up @@ -407,14 +407,10 @@ export async function serverBuild({
dynamicPages.push(normalizedPathname);
}

if (pageMatchesApi(page)) {
apiPages.push(page);
} else if (
(appPathRoutesManifest?.[`${normalizedPathname}/page`] ||
appPathRoutesManifest?.[`${normalizedPathname}/route`]) &&
lambdaAppPaths[page]
) {
if (lambdaAppPaths[page]) {
appRouterPages.push(page);
} else if (pageMatchesApi(page)) {
apiPages.push(page);
} else {
nonApiPages.push(page);
}
Expand Down
@@ -1,3 +1,5 @@
export const dynamic = 'force-dynamic'

export default function HelloPage(props) {
return (
<>
Expand Down
4 changes: 3 additions & 1 deletion packages/next/test/fixtures/00-app-dir/app/page.js
@@ -1,3 +1,5 @@
export const dynamic = 'force-dynamic'

export default function Page() {
return <p>index app page</p>;
return <p>index app page {Date.now()}</p>;
}
5 changes: 5 additions & 0 deletions packages/next/test/fixtures/00-app-dir/vercel.json
Expand Up @@ -18,6 +18,11 @@
}
],
"probes": [
{
"path": "/dashboard/hello",
"status": 200,
"mustContain": "hello from app/dashboard/rootonly/hello"
},
{
"path": "/dashboard/another-edge",
"status": 200,
Expand Down

0 comments on commit f00b08a

Please sign in to comment.