Next.js Discord

Discord Forum

revalidate runs on local dev, AND it doesnt let you conditionally set revalidate

Unanswered
Keyhole wasp posted this in #help-forum
Open in Discord
Keyhole waspOP
We want to revalidate some pages every 60 seconds etc, but want local dev to never revalidate (ie revalidate = 0). Revalidating on local dev makes no sense. We dont want to have to wait 60 seconds to see changes we make to the data being fetched in the backend. With that said, you would think you can just do

export const revalidate = process.env.NODE_ENV === "development" ? 0 : 60

but then it complains "nextjs Unsupported node type "ConditionalExpression" at "revalidate" "

0 Replies