Skip to content

Next.js 静态导出 SSG

next build 生成纯静态 HTML,可部署到任何静态服务器。

ts
// next.config.ts
const nextConfig = { output: 'export' }
bash
npm run build  # → out/ 目录(纯静态文件)

限制

  • 不能用 route.ts(API Routes)
  • 不能用 rewrites/redirects/headers
  • 不能用 ISR(revalidate

适合文档站、博客、落地页。