import type { NextConfig } from "next"; import { withPayload } from "@payloadcms/next/withPayload"; const nextConfig: NextConfig = { // Enable standalone output for Docker deployment output: 'standalone', // NOTE (Next.js 16): `next dev` auto-generates AGENTS.md/CLAUDE.md stub // files describing the framework to AI agents. This project already has // its own agent instruction system (root CLAUDE.md -> .agent/) — a second, // unrelated proto/CLAUDE.md would conflict with it, so this is disabled. agentRules: false, // NOTE (Next.js 16): `eslint.ignoreDuringBuilds` was removed — `next build` // no longer runs ESLint itself (lint is now only `next lint` / `npm run lint`), // so there is nothing left to ignore here. // Skip TypeScript checking during build (for faster Docker builds) typescript: { ignoreBuildErrors: true, }, // Optimize for production builds — Turbopack rules moved from the deprecated // experimental.turbo to the top-level turbopack key (Next 15.5). turbopack: { rules: { '*.svg': { loaders: ['@svgr/webpack'], as: '*.js', }, }, }, // Image optimization images: { formats: ['image/webp', 'image/avif'], minimumCacheTTL: 60 * 60 * 24 * 30, // 30 days }, // Security headers async headers() { return [ { // Security headers apply to every route, including static assets. source: '/:path*', headers: [ { key: 'X-Frame-Options', value: 'DENY', }, { key: 'X-Content-Type-Options', value: 'nosniff', }, { key: 'Referrer-Policy', value: 'origin-when-cross-origin', }, ], }, { // WHY: no-cache must not hit hashed build assets (_next/static) or // optimized images (_next/image); they are content-addressed and rely on // long-lived caching. Overriding them would re-download the bundle on // every page load. source: '/((?!_next/static|_next/image).*)', headers: [ { key: 'Cache-Control', value: 'private, no-cache, must-revalidate, max-age=0', }, { key: 'Pragma', value: 'no-cache' }, { key: 'Expires', value: '0' }, ], }, ]; }, }; // MITHOME-86: bundles the admin UI's route handlers correctly under // Turbopack/webpack. `@payload-config` itself resolves via the `paths` // alias in tsconfig.json (./src/payload.config.ts) — this wrapper's // installed version has no separate configPath option. export default withPayload(nextConfig);