next.config.mjs 837 B

123456789101112131415161718192021
  1. import { createMDX } from 'fumadocs-mdx/next';
  2. const withMDX = createMDX();
  3. // Set DEPLOY_TARGET=static to produce a fully static export (e.g. for GitHub
  4. // Pages). Search already uses a static index, and OG images are prerendered, so
  5. // the export is self-contained. Default (unset) builds for Vercel/Node hosting.
  6. const isStaticExport = process.env.DEPLOY_TARGET === 'static';
  7. /** @type {import('next').NextConfig} */
  8. const config = {
  9. reactStrictMode: true,
  10. // On the static host (GitHub Pages) emit directory-style routes
  11. // (`en/index.html` rather than `en.html`) so URLs with a trailing slash —
  12. // including the root `/` → `/en/` redirect — resolve instead of 404ing.
  13. ...(isStaticExport
  14. ? { output: 'export', trailingSlash: true, images: { unoptimized: true } }
  15. : {}),
  16. };
  17. export default withMDX(config);