diff --git a/packages/next/build/index.ts b/packages/next/build/index.ts index 712b5d860d363..e0baa46272fba 100644 --- a/packages/next/build/index.ts +++ b/packages/next/build/index.ts @@ -592,6 +592,7 @@ export default async function build( isHybridAmp, ssgPageRoutes, hasSsgFallback, + initialRevalidateSeconds: false, }) }) ) @@ -832,6 +833,13 @@ export default async function build( srcRoute: null, dataRoute: path.posix.join('/_next/data', buildId, `${file}.json`), } + // Set Page Revalidation Interval + const pageInfo = pageInfos.get(page) + if (pageInfo) { + pageInfo.initialRevalidateSeconds = + exportConfig.initialPageRevalidationMap[page] + pageInfos.set(page, pageInfo) + } } else { // For a dynamic SSG page, we did not copy its data exports and only // copy the fallback HTML file (if present). @@ -859,6 +867,14 @@ export default async function build( `${normalizePagePath(route)}.json` ), } + + // Set route Revalidation Interval + const pageInfo = pageInfos.get(route) + if (pageInfo) { + pageInfo.initialRevalidateSeconds = + exportConfig.initialPageRevalidationMap[route] + pageInfos.set(route, pageInfo) + } } } } diff --git a/packages/next/build/utils.ts b/packages/next/build/utils.ts index 5e4627f2b99e2..5bd93076a9b88 100644 --- a/packages/next/build/utils.ts +++ b/packages/next/build/utils.ts @@ -52,6 +52,7 @@ export interface PageInfo { isSsg: boolean ssgPageRoutes: string[] | null hasSsgFallback: boolean + initialRevalidateSeconds: number | false } export async function printTreeView( @@ -153,7 +154,11 @@ export async function printTreeView( : pageInfo?.isSsg ? '●' : 'λ' - } ${item}`, + } ${ + pageInfo?.initialRevalidateSeconds + ? `${item} (ISR: ${pageInfo?.initialRevalidateSeconds} Seconds)` + : item + }`, pageInfo ? ampFirst ? chalk.cyan('AMP') @@ -271,6 +276,13 @@ export async function printTreeView( 'getStaticProps' )})`, ], + [ + '', + '(ISR)', + `incremental static regeneration (uses revalidate in ${chalk.cyan( + 'getStaticProps' + )})`, + ], ] as [string, string, string][], { align: ['l', 'l', 'l'],