Skip to content

Commit aed2dc0

Browse files
authoredSep 19, 2022
Add handling for static generation in app (#40561)
x-ref: [internal notes](https://www.notion.so/vercel/App-Static-Generation-dc5f1e0916684501b586e56a5b7b9483)
1 parent 4a53582 commit aed2dc0

File tree

86 files changed

+1805
-804
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1805
-804
lines changed
 

‎packages/next/build/index.ts

+186-44
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ import {
9797
printTreeView,
9898
copyTracedFiles,
9999
isReservedPage,
100+
AppConfig,
100101
} from './utils'
101102
import getBaseWebpackConfig from './webpack-config'
102103
import { PagesManifest } from './webpack/plugins/pages-manifest-plugin'
@@ -1065,6 +1066,11 @@ export default async function build(
10651066
const serverPropsPages = new Set<string>()
10661067
const additionalSsgPaths = new Map<string, Array<string>>()
10671068
const additionalSsgPathsEncoded = new Map<string, Array<string>>()
1069+
const appStaticPaths = new Map<string, Array<string>>()
1070+
const appStaticPathsEncoded = new Map<string, Array<string>>()
1071+
const appNormalizedPaths = new Map<string, string>()
1072+
const appDynamicParamPaths = new Set<string>()
1073+
const appDefaultConfigs = new Map<string, AppConfig>()
10681074
const pageTraceIncludes = new Map<string, Array<string>>()
10691075
const pageTraceExcludes = new Map<string, Array<string>>()
10701076
const pageInfos = new Map<string, PageInfo>()
@@ -1087,6 +1093,26 @@ export default async function build(
10871093
: require.resolve('./utils')
10881094
let infoPrinted = false
10891095

1096+
let appPathsManifest: Record<string, string> = {}
1097+
const appPathRoutes: Record<string, string> = {}
1098+
1099+
if (appDir) {
1100+
appPathsManifest = JSON.parse(
1101+
await promises.readFile(
1102+
path.join(distDir, serverDir, APP_PATHS_MANIFEST),
1103+
'utf8'
1104+
)
1105+
)
1106+
1107+
Object.keys(appPathsManifest).forEach((entry) => {
1108+
appPathRoutes[entry] = normalizeAppPath(entry) || '/'
1109+
})
1110+
await promises.writeFile(
1111+
path.join(distDir, APP_PATH_ROUTES_MANIFEST),
1112+
JSON.stringify(appPathRoutes, null, 2)
1113+
)
1114+
}
1115+
10901116
process.env.NEXT_PHASE = PHASE_PRODUCTION_BUILD
10911117

10921118
const staticWorkers = new Worker(staticWorker, {
@@ -1255,33 +1281,49 @@ export default async function build(
12551281
let isHybridAmp = false
12561282
let ssgPageRoutes: string[] | null = null
12571283

1258-
const pagePath =
1259-
pageType === 'pages'
1260-
? pagesPaths.find(
1261-
(p) =>
1262-
p.startsWith(actualPage + '.') ||
1263-
p.startsWith(actualPage + '/index.')
1284+
let pagePath = ''
1285+
1286+
if (pageType === 'pages') {
1287+
pagePath =
1288+
pagesPaths.find(
1289+
(p) =>
1290+
p.startsWith(actualPage + '.') ||
1291+
p.startsWith(actualPage + '/index.')
1292+
) || ''
1293+
}
1294+
let originalAppPath: string | undefined
1295+
1296+
if (pageType === 'app' && mappedAppPages) {
1297+
for (const [originalPath, normalizedPath] of Object.entries(
1298+
appPathRoutes
1299+
)) {
1300+
if (normalizedPath === page) {
1301+
pagePath = mappedAppPages[originalPath].replace(
1302+
/^private-next-app-dir/,
1303+
''
12641304
)
1265-
: appPaths?.find((p) => p.startsWith(actualPage + '/page.'))
1305+
originalAppPath = originalPath
1306+
break
1307+
}
1308+
}
1309+
}
12661310

1267-
const staticInfo =
1268-
pagesDir && pageType === 'pages' && pagePath
1269-
? await getPageStaticInfo({
1270-
pageFilePath: join(pagesDir, pagePath),
1271-
nextConfig: config,
1272-
})
1273-
: {}
1274-
const pageRuntime = staticInfo.runtime
1311+
const staticInfo = pagePath
1312+
? await getPageStaticInfo({
1313+
pageFilePath: join(
1314+
(pageType === 'pages' ? pagesDir : appDir) || '',
1315+
pagePath
1316+
),
1317+
nextConfig: config,
1318+
})
1319+
: undefined
1320+
1321+
const pageRuntime = staticInfo?.runtime
12751322
isServerComponent =
12761323
pageType === 'app' &&
1277-
staticInfo.rsc !== RSC_MODULE_TYPES.client
1324+
staticInfo?.rsc !== RSC_MODULE_TYPES.client
12781325

1279-
if (
1280-
// Only calculate page static information if the page is not an
1281-
// app page.
1282-
pageType !== 'app' &&
1283-
!isReservedPage(page)
1284-
) {
1326+
if (!isReservedPage(page)) {
12851327
try {
12861328
let edgeInfo: any
12871329

@@ -1291,8 +1333,10 @@ export default async function build(
12911333
serverDir,
12921334
MIDDLEWARE_MANIFEST
12931335
))
1336+
const manifestKey =
1337+
pageType === 'pages' ? page : join(page, 'page')
12941338

1295-
edgeInfo = manifest.functions[page]
1339+
edgeInfo = manifest.functions[manifestKey]
12961340
}
12971341

12981342
let isPageStaticSpan =
@@ -1301,6 +1345,7 @@ export default async function build(
13011345
() => {
13021346
return staticWorkers.isPageStatic({
13031347
page,
1348+
originalAppPath,
13041349
distDir,
13051350
serverless: isLikeServerless,
13061351
configFileName,
@@ -1311,10 +1356,50 @@ export default async function build(
13111356
parentId: isPageStaticSpan.id,
13121357
pageRuntime,
13131358
edgeInfo,
1359+
pageType,
1360+
hasServerComponents,
13141361
})
13151362
}
13161363
)
13171364

1365+
if (pageType === 'app' && originalAppPath) {
1366+
appNormalizedPaths.set(originalAppPath, page)
1367+
1368+
// TODO-APP: handle prerendering with edge
1369+
// runtime
1370+
if (pageRuntime === 'experimental-edge') {
1371+
return
1372+
}
1373+
1374+
if (
1375+
workerResult.encodedPrerenderRoutes &&
1376+
workerResult.prerenderRoutes
1377+
) {
1378+
appStaticPaths.set(
1379+
originalAppPath,
1380+
workerResult.prerenderRoutes
1381+
)
1382+
appStaticPathsEncoded.set(
1383+
originalAppPath,
1384+
workerResult.encodedPrerenderRoutes
1385+
)
1386+
}
1387+
if (!isDynamicRoute(page)) {
1388+
appStaticPaths.set(originalAppPath, [page])
1389+
appStaticPathsEncoded.set(originalAppPath, [page])
1390+
}
1391+
if (workerResult.prerenderFallback) {
1392+
// whether or not to allow requests for paths not
1393+
// returned from generateStaticParams
1394+
appDynamicParamPaths.add(originalAppPath)
1395+
}
1396+
appDefaultConfigs.set(
1397+
originalAppPath,
1398+
workerResult.appConfig || {}
1399+
)
1400+
return
1401+
}
1402+
13181403
if (pageRuntime === SERVER_RUNTIME.edge) {
13191404
if (workerResult.hasStaticProps) {
13201405
console.warn(
@@ -1821,24 +1906,6 @@ export default async function build(
18211906
'utf8'
18221907
)
18231908

1824-
if (appDir) {
1825-
const appPathsManifest = JSON.parse(
1826-
await promises.readFile(
1827-
path.join(distDir, serverDir, APP_PATHS_MANIFEST),
1828-
'utf8'
1829-
)
1830-
)
1831-
const appPathRoutes: Record<string, string> = {}
1832-
1833-
Object.keys(appPathsManifest).forEach((entry) => {
1834-
appPathRoutes[entry] = normalizeAppPath(entry) || '/'
1835-
})
1836-
await promises.writeFile(
1837-
path.join(distDir, APP_PATH_ROUTES_MANIFEST),
1838-
JSON.stringify(appPathRoutes, null, 2)
1839-
)
1840-
}
1841-
18421909
const middlewareManifest: MiddlewareManifest = JSON.parse(
18431910
await promises.readFile(
18441911
path.join(distDir, serverDir, MIDDLEWARE_MANIFEST),
@@ -1865,6 +1932,7 @@ export default async function build(
18651932
}
18661933

18671934
const finalPrerenderRoutes: { [route: string]: SsgRoute } = {}
1935+
const finalDynamicRoutes: PrerenderManifest['dynamicRoutes'] = {}
18681936
const tbdPrerenderRoutes: string[] = []
18691937
let ssgNotFoundPaths: string[] = []
18701938

@@ -1889,7 +1957,16 @@ export default async function build(
18891957

18901958
const combinedPages = [...staticPages, ...ssgPages]
18911959

1892-
if (combinedPages.length > 0 || useStatic404 || useDefaultStatic500) {
1960+
// we need to trigger automatic exporting when we have
1961+
// - static 404/500
1962+
// - getStaticProps paths
1963+
// - experimental app is enabled
1964+
if (
1965+
combinedPages.length > 0 ||
1966+
useStatic404 ||
1967+
useDefaultStatic500 ||
1968+
config.experimental.appDir
1969+
) {
18931970
const staticGenerationSpan =
18941971
nextBuildSpan.traceChild('static-generation')
18951972
await staticGenerationSpan.traceAsyncFn(async () => {
@@ -1986,6 +2063,20 @@ export default async function build(
19862063
}
19872064
}
19882065

2066+
// TODO: output manifest specific to app paths and their
2067+
// revalidate periods and dynamicParams settings
2068+
appStaticPaths.forEach((routes, originalAppPath) => {
2069+
const encodedRoutes = appStaticPathsEncoded.get(originalAppPath)
2070+
2071+
routes.forEach((route, routeIdx) => {
2072+
defaultMap[route] = {
2073+
page: originalAppPath,
2074+
query: { __nextSsgPath: encodedRoutes?.[routeIdx] },
2075+
_isAppDir: true,
2076+
}
2077+
})
2078+
})
2079+
19892080
if (i18n) {
19902081
for (const page of [
19912082
...staticPages,
@@ -2035,6 +2126,58 @@ export default async function build(
20352126
await promises.unlink(serverBundle)
20362127
}
20372128

2129+
for (const [originalAppPath, routes] of appStaticPaths) {
2130+
const page = appNormalizedPaths.get(originalAppPath) || ''
2131+
const appConfig = appDefaultConfigs.get(originalAppPath) || {}
2132+
let hasDynamicData = appConfig.revalidate === 0
2133+
2134+
routes.forEach((route) => {
2135+
let revalidate = exportConfig.initialPageRevalidationMap[route]
2136+
2137+
if (typeof revalidate === 'undefined') {
2138+
revalidate =
2139+
typeof appConfig.revalidate !== 'undefined'
2140+
? appConfig.revalidate
2141+
: false
2142+
}
2143+
if (revalidate !== 0) {
2144+
const normalizedRoute = normalizePagePath(route)
2145+
const dataRoute = path.posix.join(`${normalizedRoute}.rsc`)
2146+
finalPrerenderRoutes[route] = {
2147+
initialRevalidateSeconds: revalidate,
2148+
srcRoute: page,
2149+
dataRoute,
2150+
}
2151+
} else {
2152+
hasDynamicData = true
2153+
}
2154+
})
2155+
2156+
if (!hasDynamicData && isDynamicRoute(originalAppPath)) {
2157+
const normalizedRoute = normalizePagePath(page)
2158+
const dataRoute = path.posix.join(`${normalizedRoute}.rsc`)
2159+
2160+
// TODO: create a separate manifest to allow enforcing
2161+
// dynamicParams for non-static paths?
2162+
finalDynamicRoutes[page] = {
2163+
routeRegex: normalizeRouteRegex(
2164+
getNamedRouteRegex(page).re.source
2165+
),
2166+
dataRoute,
2167+
// if dynamicParams are enabled treat as fallback:
2168+
// 'blocking' if not it's fallback: false
2169+
fallback: appDynamicParamPaths.has(originalAppPath)
2170+
? null
2171+
: false,
2172+
dataRouteRegex: normalizeRouteRegex(
2173+
getNamedRouteRegex(
2174+
dataRoute.replace(/\.rsc$/, '')
2175+
).re.source.replace(/\(\?:\\\/\)\?\$$/, '\\.rsc$')
2176+
),
2177+
}
2178+
}
2179+
}
2180+
20382181
const moveExportedPage = async (
20392182
originPage: string,
20402183
page: string,
@@ -2347,8 +2490,7 @@ export default async function build(
23472490
telemetry.record(eventPackageUsedInGetServerSideProps(telemetryPlugin))
23482491
}
23492492

2350-
if (ssgPages.size > 0) {
2351-
const finalDynamicRoutes: PrerenderManifest['dynamicRoutes'] = {}
2493+
if (ssgPages.size > 0 || appDir) {
23522494
tbdPrerenderRoutes.forEach((tbdRoute) => {
23532495
const normalizedRoute = normalizePagePath(tbdRoute)
23542496
const dataRoute = path.posix.join(

‎packages/next/build/utils.ts

+237-22
Original file line numberDiff line numberDiff line change
@@ -813,13 +813,21 @@ export async function getJsPageSizeInKb(
813813
return [-1, -1]
814814
}
815815

816-
export async function buildStaticPaths(
817-
page: string,
818-
getStaticPaths: GetStaticPaths,
819-
configFileName: string,
820-
locales?: string[],
816+
export async function buildStaticPaths({
817+
page,
818+
getStaticPaths,
819+
staticPathsResult,
820+
configFileName,
821+
locales,
822+
defaultLocale,
823+
}: {
824+
page: string
825+
getStaticPaths?: GetStaticPaths
826+
staticPathsResult?: UnwrapPromise<ReturnType<GetStaticPaths>>
827+
configFileName: string
828+
locales?: string[]
821829
defaultLocale?: string
822-
): Promise<
830+
}): Promise<
823831
Omit<UnwrapPromise<ReturnType<GetStaticPaths>>, 'paths'> & {
824832
paths: string[]
825833
encodedPaths: string[]
@@ -833,7 +841,15 @@ export async function buildStaticPaths(
833841
// Get the default list of allowed params.
834842
const _validParamKeys = Object.keys(_routeMatcher(page))
835843

836-
const staticPathsResult = await getStaticPaths({ locales, defaultLocale })
844+
if (!staticPathsResult) {
845+
if (getStaticPaths) {
846+
staticPathsResult = await getStaticPaths({ locales, defaultLocale })
847+
} else {
848+
throw new Error(
849+
`invariant: attempted to buildStaticPaths without "staticPathsResult" or "getStaticPaths" ${page}`
850+
)
851+
}
852+
}
837853

838854
const expectedReturnVal =
839855
`Expected: { paths: [], fallback: boolean }\n` +
@@ -1013,6 +1029,137 @@ export async function buildStaticPaths(
10131029
}
10141030
}
10151031

1032+
export type AppConfig = {
1033+
revalidate?: number | false
1034+
dynamicParams?: true | false
1035+
dynamic?: 'auto' | 'error' | 'force-static'
1036+
fetchCache?: 'force-cache' | 'only-cache'
1037+
preferredRegion?: string
1038+
}
1039+
type GenerateParams = Array<{
1040+
config: AppConfig
1041+
segmentPath: string
1042+
getStaticPaths?: GetStaticPaths
1043+
generateStaticParams?: any
1044+
isLayout?: boolean
1045+
}>
1046+
1047+
export const collectGenerateParams = (
1048+
segment: any,
1049+
parentSegments: string[] = [],
1050+
generateParams: GenerateParams = []
1051+
): GenerateParams => {
1052+
if (!Array.isArray(segment)) return generateParams
1053+
const isLayout = !!segment[2]?.layout
1054+
const mod = isLayout ? segment[2]?.layout?.() : segment[2]?.page?.()
1055+
1056+
const result = {
1057+
isLayout,
1058+
segmentPath: `/${parentSegments.join('/')}${
1059+
segment[0] && parentSegments.length > 0 ? '/' : ''
1060+
}${segment[0]}`,
1061+
config: mod?.config,
1062+
getStaticPaths: mod?.getStaticPaths,
1063+
generateStaticParams: mod?.generateStaticParams,
1064+
}
1065+
1066+
if (segment[0]) {
1067+
parentSegments.push(segment[0])
1068+
}
1069+
1070+
if (result.config || result.generateStaticParams || result.getStaticPaths) {
1071+
generateParams.push(result)
1072+
}
1073+
return collectGenerateParams(
1074+
segment[1]?.children,
1075+
parentSegments,
1076+
generateParams
1077+
)
1078+
}
1079+
1080+
export async function buildAppStaticPaths({
1081+
page,
1082+
configFileName,
1083+
generateParams,
1084+
}: {
1085+
page: string
1086+
configFileName: string
1087+
generateParams: GenerateParams
1088+
}) {
1089+
const pageEntry = generateParams[generateParams.length - 1]
1090+
1091+
// if the page has legacy getStaticPaths we call it like normal
1092+
if (typeof pageEntry?.getStaticPaths === 'function') {
1093+
return buildStaticPaths({
1094+
page,
1095+
configFileName,
1096+
getStaticPaths: pageEntry.getStaticPaths,
1097+
})
1098+
} else {
1099+
// if generateStaticParams is being used we iterate over them
1100+
// collecting them from each level
1101+
type Params = Array<Record<string, string | string[]>>
1102+
let hadGenerateParams = false
1103+
1104+
const buildParams = async (
1105+
paramsItems: Params = [{}],
1106+
idx = 0
1107+
): Promise<Params> => {
1108+
const curGenerate = generateParams[idx]
1109+
1110+
if (idx === generateParams.length) {
1111+
return paramsItems
1112+
}
1113+
if (
1114+
typeof curGenerate.generateStaticParams !== 'function' &&
1115+
idx < generateParams.length
1116+
) {
1117+
return buildParams(paramsItems, idx + 1)
1118+
}
1119+
hadGenerateParams = true
1120+
1121+
const newParams = []
1122+
1123+
for (const params of paramsItems) {
1124+
const result = await curGenerate.generateStaticParams({ params })
1125+
// TODO: validate the result is valid here or wait for
1126+
// buildStaticPaths to validate?
1127+
for (const item of result.params) {
1128+
newParams.push({ ...params, ...item })
1129+
}
1130+
}
1131+
1132+
if (idx < generateParams.length) {
1133+
return buildParams(newParams, idx + 1)
1134+
}
1135+
return newParams
1136+
}
1137+
const builtParams = await buildParams()
1138+
const fallback = !generateParams.some(
1139+
// TODO: check complementary configs that can impact
1140+
// dynamicParams behavior
1141+
(generate) => generate.config?.dynamicParams === false
1142+
)
1143+
1144+
if (!hadGenerateParams) {
1145+
return {
1146+
paths: undefined,
1147+
fallback: undefined,
1148+
encodedPaths: undefined,
1149+
}
1150+
}
1151+
1152+
return buildStaticPaths({
1153+
staticPathsResult: {
1154+
fallback,
1155+
paths: builtParams.map((params) => ({ params })),
1156+
},
1157+
page,
1158+
configFileName,
1159+
})
1160+
}
1161+
}
1162+
10161163
export async function isPageStatic({
10171164
page,
10181165
distDir,
@@ -1025,6 +1172,9 @@ export async function isPageStatic({
10251172
parentId,
10261173
pageRuntime,
10271174
edgeInfo,
1175+
pageType,
1176+
hasServerComponents,
1177+
originalAppPath,
10281178
}: {
10291179
page: string
10301180
distDir: string
@@ -1036,7 +1186,10 @@ export async function isPageStatic({
10361186
defaultLocale?: string
10371187
parentId?: any
10381188
edgeInfo?: any
1189+
pageType?: 'pages' | 'app'
10391190
pageRuntime: ServerRuntime
1191+
hasServerComponents?: boolean
1192+
originalAppPath?: string
10401193
}): Promise<{
10411194
isStatic?: boolean
10421195
isAmpOnly?: boolean
@@ -1049,6 +1202,7 @@ export async function isPageStatic({
10491202
isNextImageImported?: boolean
10501203
traceIncludes?: string[]
10511204
traceExcludes?: string[]
1205+
appConfig?: AppConfig
10521206
}> {
10531207
const isPageStaticSpan = trace('is-page-static-utils', parentId)
10541208
return isPageStaticSpan
@@ -1057,6 +1211,10 @@ export async function isPageStatic({
10571211
setHttpAgentOptions(httpAgentOptions)
10581212

10591213
let componentsResult: LoadComponentsReturnType
1214+
let prerenderRoutes: Array<string> | undefined
1215+
let encodedPrerenderRoutes: Array<string> | undefined
1216+
let prerenderFallback: boolean | 'blocking' | undefined
1217+
let appConfig: AppConfig = {}
10601218

10611219
if (pageRuntime === SERVER_RUNTIME.edge) {
10621220
const runtime = await getRuntimeContext({
@@ -1084,16 +1242,74 @@ export async function isPageStatic({
10841242
} else {
10851243
componentsResult = await loadComponents({
10861244
distDir,
1087-
pathname: page,
1245+
pathname: originalAppPath || page,
10881246
serverless,
1089-
hasServerComponents: false,
1090-
isAppPath: false,
1247+
hasServerComponents: !!hasServerComponents,
1248+
isAppPath: pageType === 'app',
10911249
})
10921250
}
1093-
const Comp = componentsResult.Component
1251+
const Comp = componentsResult.Component || {}
1252+
let staticPathsResult:
1253+
| UnwrapPromise<ReturnType<GetStaticPaths>>
1254+
| undefined
1255+
1256+
if (pageType === 'app') {
1257+
const tree = componentsResult.ComponentMod.tree
1258+
const generateParams = collectGenerateParams(tree)
1259+
1260+
appConfig = generateParams.reduce(
1261+
(builtConfig: AppConfig, curGenParams): AppConfig => {
1262+
const {
1263+
dynamic,
1264+
fetchCache,
1265+
preferredRegion,
1266+
revalidate: curRevalidate,
1267+
} = curGenParams?.config || {}
1268+
1269+
// TODO: should conflicting configs here throw an error
1270+
// e.g. if layout defines one region but page defines another
1271+
if (typeof builtConfig.preferredRegion === 'undefined') {
1272+
builtConfig.preferredRegion = preferredRegion
1273+
}
1274+
if (typeof builtConfig.dynamic === 'undefined') {
1275+
builtConfig.dynamic = dynamic
1276+
}
1277+
if (typeof builtConfig.fetchCache === 'undefined') {
1278+
builtConfig.fetchCache = fetchCache
1279+
}
1280+
1281+
// any revalidate number overrides false
1282+
// shorter revalidate overrides longer (initially)
1283+
if (typeof builtConfig.revalidate === 'undefined') {
1284+
builtConfig.revalidate = curRevalidate
1285+
}
1286+
if (
1287+
typeof curRevalidate === 'number' &&
1288+
(typeof builtConfig.revalidate !== 'number' ||
1289+
curRevalidate < builtConfig.revalidate)
1290+
) {
1291+
builtConfig.revalidate = curRevalidate
1292+
}
1293+
return builtConfig
1294+
},
1295+
{}
1296+
)
10941297

1095-
if (!Comp || !isValidElementType(Comp) || typeof Comp === 'string') {
1096-
throw new Error('INVALID_DEFAULT_EXPORT')
1298+
if (isDynamicRoute(page)) {
1299+
;({
1300+
paths: prerenderRoutes,
1301+
fallback: prerenderFallback,
1302+
encodedPaths: encodedPrerenderRoutes,
1303+
} = await buildAppStaticPaths({
1304+
page,
1305+
configFileName,
1306+
generateParams,
1307+
}))
1308+
}
1309+
} else {
1310+
if (!Comp || !isValidElementType(Comp) || typeof Comp === 'string') {
1311+
throw new Error('INVALID_DEFAULT_EXPORT')
1312+
}
10971313
}
10981314

10991315
const hasGetInitialProps = !!(Comp as any).getInitialProps
@@ -1163,21 +1379,19 @@ export async function isPageStatic({
11631379
)
11641380
}
11651381

1166-
let prerenderRoutes: Array<string> | undefined
1167-
let encodedPrerenderRoutes: Array<string> | undefined
1168-
let prerenderFallback: boolean | 'blocking' | undefined
1169-
if (hasStaticProps && hasStaticPaths) {
1382+
if ((hasStaticProps && hasStaticPaths) || staticPathsResult) {
11701383
;({
11711384
paths: prerenderRoutes,
11721385
fallback: prerenderFallback,
11731386
encodedPaths: encodedPrerenderRoutes,
1174-
} = await buildStaticPaths(
1387+
} = await buildStaticPaths({
11751388
page,
1176-
componentsResult.getStaticPaths!,
1177-
configFileName,
11781389
locales,
1179-
defaultLocale
1180-
))
1390+
defaultLocale,
1391+
configFileName,
1392+
staticPathsResult,
1393+
getStaticPaths: componentsResult.getStaticPaths!,
1394+
}))
11811395
}
11821396

11831397
const isNextImageImported = (global as any).__NEXT_IMAGE_IMPORTED
@@ -1194,6 +1408,7 @@ export async function isPageStatic({
11941408
isNextImageImported,
11951409
traceIncludes: config.unstable_includeFiles || [],
11961410
traceExcludes: config.unstable_excludeFiles || [],
1411+
appConfig,
11971412
}
11981413
})
11991414
.catch((err) => {

0 commit comments

Comments
 (0)
Please sign in to comment.