Menu

1 / 5

4 Next.js 16 traps that break static exports, OG images and blog routes

DEV Community: react·Nando Septian Husni·17 days ago
#9mmy7WxX
#devtoreact#devto#dev#export#enter
Long article (1043 words) — no AI summary yet.
Reading 0:00
15s threshold

I recently tested a set of Next.js templates (landing page, SEO files, OG images, an MDX blog) in a fresh create-next-app project on Next.js 16.4.6 , twice: once as a static export and once as a server build with Cache Components.

Everything compiled in my head. Four things broke in practice, and none of them is obvious from the docs. Here they are, with the exact errors and the fixes that worked.

1. Static export and Cache Components don't mix

New projects from create-next-app 16.4 start with this config:

const nextConfig : NextConfig = { cacheComponents : true , partialPrefetching : true , } ;

Enter fullscreen mode

Exit fullscreen mode

Add output: "export" for a static site (Cloudflare Pages, GitHub Pages, Netlify), plus an opengraph-image.tsx or sitemap.ts , and the build stops:

Error: export const dynamic = "force-static"/export const revalidate not configured on route "/opengraph-image" with "output: export".

Enter fullscreen mode

Exit fullscreen mode

The obvious fix makes it worse:

Error:…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.