NextJS Static Export
I am building a NextJS app that is going to be static. For that, in my articles path I have a dynamic route. Using generateStaticParams I call the backend to retrieve all articles so we know with what values the path param will be used. This seems to work great. However, what I now see when I run npm run build (with all, bun, npm and pnpm) is my page also does a call on the backend with the value
[id] which is the folder name and thus dynanmic route segment. I do not expect that to happen. Why does that happen, and how can I mitigate that? I just feel dumb now.Solution
Also have you maybe opt out of caching? https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#opting-out-of-data-caching
Learn how to fetch, cache, and revalidate data in your Next.js application.