Skip to content

Commit

Permalink
filter default segments from prerender manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
ztanner committed Jan 11, 2024
1 parent d6c754f commit 7b4885e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/next/src/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ import type { NextEnabledDirectories } from '../server/base-server'
import { hasCustomExportOutput } from '../export/utils'
import { interopDefault } from '../lib/interop-default'
import { formatDynamicImportPath } from '../lib/format-dynamic-import-path'
import { isDefaultRoute } from '../lib/is-default-route'

interface ExperimentalBypassForInfo {
experimentalBypassFor?: RouteHas[]
Expand Down Expand Up @@ -2516,6 +2517,7 @@ export default async function build(
routes.forEach((route) => {
if (isDynamicRoute(page) && route === page) return
if (route === '/_not-found') return
if (isDefaultRoute(page)) return

const {
revalidate = appConfig.revalidate ?? false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ createNextDescribe(
{
files: __dirname,
},
({ next, isNextDev }) => {
({ next, isNextDev, isNextStart }) => {
describe('parallel routes', () => {
it('should support parallel route tab bars', async () => {
const browser = await next.browser('/parallel-tab-bar')
Expand Down Expand Up @@ -821,6 +821,20 @@ createNextDescribe(

await check(() => browser.waitForElementByCss('#main-slot').text(), '1')
})

if (isNextStart) {
it('should not have /default paths in the prerender manifest', async () => {
const prerenderManifest = JSON.parse(
await next.readFile('.next/prerender-manifest.json')
)

const keys = Object.keys(prerenderManifest.routes)

for (const key of keys) {
expect(key.endsWith('/default')).toBe(false)
}
})
}
})
}
)

0 comments on commit 7b4885e

Please sign in to comment.