aicode8
Next.jsUpdated: 2026-09-10

Next.js in practice: pure static export

Use output:export to ship Next.js as pure static files, capturing React ecosystem traffic without server-side dependencies.

On this page

Quick answer

Does Next.js require Vercel?

No. output:export can host on any static platform, including Cloudflare Pages.

Machine-readable page data: /data/nextjs-practical.json

In-depth analysis

Next.js is the dominant React meta-framework. output:export produces pure static output, but the core engine here is still Astro — Next pages exist here only for comparison and traffic capture. Three steps: (1) set output:export in next.config; (2) set images.unoptimized=true to disable server-side image optimization; (3) next build then next export to produce out/. Bottom line up front: when you need the React ecosystem but want pure static hosting, output:export is the lowest-friction path. Common pitfalls are using dynamic-route server data fetching or middleware under export mode, and forgetting images.unoptimized which breaks the export.

Next.js · Config example
// next.config.mjs — pure static export (no server functions)
const nextConfig = { output: 'export', images: { unoptimized: true } };
export default nextConfig;
// Build: next build && next export
Best practices:Before cross-environment deployment, smoke-test dependency versions and build cache to prevent implicit version conflicts from leaking to production.
Pitfalls:output:export forbids dynamic-route server data fetching and middleware. Forgetting images.unoptimized breaks the export. Before cross-environment deployment, smoke-test dependency versions and build cache to prevent implicit version conflicts.

Next.js Overview · Key takeaways

  • Tech choice and boundaries confirmed
  • Core config in place
  • Locally verified
  • Postmortem notes recorded

FAQ & pitfalls

How do I choose between Astro and Next?

For content sites and bulk long-tail pages, prefer Astro (zero-JS first paint). For heavy interactive apps, look at Next.

Share & save

My shelf0
← Back to homeTopic: Next.js in practice

What readers are asking

Questions that keep coming back in reader feedback, already answered.

  1. 01
    How do I fix a failing Next.js output: export build?

    Server-side data fetching in dynamic routes, and middleware, both break the export; next/image also needs unoptimized or the export aborts.

    See the full guide →
  2. 02
    Why is my Astro component's interactivity not working?

    Components ship as zero-JS HTML by default, so an interactive one needs a client:* directive (client:load, client:visible, …). Without it the script is never bundled into the page.

    See the full guide →
  3. 03
    Why is my custom Tailwind v4 brand colour not applied?

    Colours must be declared in @theme (for example --color-brand). A missing @tailwindcss/vite plugin, or a leftover v3 config, makes bg-brand silently render nothing.

    See the full guide →
All questions →

Follow along as I build with AI

Get the honest, real-time record: what I build, what breaks, and what I learn — from a non-technical founder. No jargon, no fluff.

We respect your inbox. One click to unsubscribe, anytime.