Next.js Discord

Discord Forum

with the "use cache" directive, is it possible to mark a function as "run at build time only"?

Unanswered
New Zealand posted this in #help-forum
Open in Discord
Avatar
New ZealandOP
with the "use cache" directive, is it possible to mark a function as "run at build time only"?

7 Replies

Avatar
West African Lion
no thats not how it works
usually functions dont run until first render time as cache usually client-sided
defeats the point of caching in most cases if it still needs to be fetched externally
Avatar
New ZealandOP
the Next.js "Data Cache" used by "use cache" is definitely not a client-side cache
Avatar
Yes you can do run at build time only.. without use cache
export const dynamic = force-static
Avatar
@New Zealand any updates?