diff --git a/src/lib/pages/getStaticPropsWithRevalidate/pages.js b/src/lib/pages/getStaticPropsWithRevalidate/pages.js index 9e3d5d6163..9c1775556b 100644 --- a/src/lib/pages/getStaticPropsWithRevalidate/pages.js +++ b/src/lib/pages/getStaticPropsWithRevalidate/pages.js @@ -1,3 +1,5 @@ +const { yellowBright } = require('chalk') + const asyncForEach = require('../../helpers/asyncForEach') const getPrerenderManifest = require('../../helpers/getPrerenderManifest') const isRouteWithFallback = require('../../helpers/isRouteWithFallback') @@ -9,10 +11,14 @@ const getPages = async () => { // Collect pages const pages = [] + let usesRevalidateAtLeastOnce = false + await asyncForEach(Object.entries(routes), async ([route, { dataRoute, srcRoute, initialRevalidateSeconds }]) => { // Skip pages without revalidate, these are handled by getStaticProps/pages if (!initialRevalidateSeconds) return + usesRevalidateAtLeastOnce = true + // Skip pages with fallback, these are handled by // getStaticPropsWithFallback/pages if (await isRouteWithFallback(srcRoute)) return @@ -24,6 +30,15 @@ const getPages = async () => { dataRoute, }) }) + + if (usesRevalidateAtLeastOnce) { + console.log( + yellowBright( + `Warning: It looks like you're using the 'revalidate' flag in one of your Next.js pages. Please read our docs about ISR on Netlify: https://ntl.fyi/next-isr-info`, + ), + ) + } + return pages }