Shumiland/next.config.ts
Vadym Samoilenko 095beb0303
Some checks are pending
CI / Type Check (push) Waiting to run
CI / Lint (push) Waiting to run
CI / Unit Tests (push) Waiting to run
Deploy / Build & Push Image (push) Waiting to run
Deploy / Deploy to VPS (push) Blocked by required conditions
fix(assets): rename assets to v2 to bust immutable browser cache; fix /images/ cache header
- Rename all new Figma 2026 assets to *-v2.webp so browsers load fresh
  copies instead of serving year-old cached originals
- Change Cache-Control for /images/ from immutable (1 year) to
  must-revalidate (1 day) — public/ files are mutable, not hashed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 15:13:44 +01:00

45 lines
1.5 KiB
TypeScript

import { withPayload } from '@payloadcms/next/withPayload'
import type { NextConfig } from 'next'
const ONE_YEAR = 'public, max-age=31536000, immutable'
const ONE_DAY = 'public, max-age=86400, must-revalidate'
const nextConfig: NextConfig = {
output: 'standalone',
reactStrictMode: true,
async headers() {
return [
{
// public/ images are mutable (replaced in-place) — allow daily revalidation
source: '/images/:path*',
headers: [{ key: 'Cache-Control', value: ONE_DAY }],
},
{
// _next/static/ assets have content-hashed filenames — safe to cache forever
source: '/_next/static/:path*',
headers: [{ key: 'Cache-Control', value: ONE_YEAR }],
},
]
},
webpack: (config) => {
config.watchOptions = {
...config.watchOptions,
ignored: /node_modules|importMap\.js|\.next/,
}
return config
},
images: {
formats: ['image/avif', 'image/webp'],
deviceSizes: [375, 640, 768, 1024, 1280, 1536, 1920],
imageSizes: [16, 32, 64, 96, 128, 256, 384, 512, 694],
minimumCacheTTL: 31536000,
remotePatterns: [
{ protocol: 'http', hostname: 'localhost', port: '3000', pathname: '/media/**' },
{ protocol: 'https', hostname: 'shumiland.com.ua', pathname: '/media/**' },
{ protocol: 'https', hostname: 'shumi.ai-impress.com', pathname: '/api/media/**' },
{ protocol: 'http', hostname: 'localhost', port: '3000', pathname: '/api/media/**' },
],
},
}
export default withPayload(nextConfig)