Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exclude default routes from isPageStatic check #61173

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/next/src/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ import {
isReservedPage,
isAppBuiltinNotFoundPage,
serializePageInfos,
isReservedAppPage,
} from './utils'
import type { PageInfo, PageInfos, AppConfig } from './utils'
import { writeBuildId } from './write-build-id'
Expand Down Expand Up @@ -1794,7 +1795,10 @@ export default async function build(
pageType === 'app' &&
staticInfo?.rsc !== RSC_MODULE_TYPES.client

if (pageType === 'app' || !isReservedPage(page)) {
if (
(pageType === 'app' && !isReservedAppPage(page)) ||
(pageType === 'pages' && !isReservedPage(page))
) {
try {
let edgeInfo: any

Expand Down
5 changes: 5 additions & 0 deletions packages/next/src/build/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ import { interopDefault } from '../lib/interop-default'
import type { PageExtensions } from './page-extensions-type'
import { formatDynamicImportPath } from '../lib/format-dynamic-import-path'
import { isInterceptionRouteAppPath } from '../server/future/helpers/interception-routes'
import { isDefaultRoute } from '../lib/is-default-route'

export type ROUTER_TYPE = 'pages' | 'app'

Expand Down Expand Up @@ -2123,6 +2124,10 @@ export function isReservedPage(page: string) {
return RESERVED_PAGE.test(page)
}

export function isReservedAppPage(page: string) {
return isDefaultRoute(page)
}

export function isAppBuiltinNotFoundPage(page: string) {
return /next[\\/]dist[\\/]client[\\/]components[\\/]not-found-error/.test(
page
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function Page() {
return 'default'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function Page() {
return '@slot'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export const runtime = 'edge'

export default function Layout({
children,
slot,
}: {
children: React.ReactNode
slot: React.ReactNode
}) {
return (
<div>
<h1>Layout</h1>
{children}
{slot}
</div>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function Page() {
return <div>Hello World</div>
}
Loading