Skip to content

Full Toolkit for Next-Level Domain Analysis

1.6 KB
Raw Blame
import type { NextConfig } from 'next';

import { getSponsorImageRemotePatterns } from './lib/sponsors';

const nextConfig = async (): Promise<NextConfig> => ({
  cacheComponents: true,
  env: {
    // A stale browser bundle reports its own deployment, not the one ingesting the log.
    NEXT_PUBLIC_DEPLOYMENT_COMMIT: process.env.VERCEL_GIT_COMMIT_SHA ?? 'local',
    NEXT_PUBLIC_DEPLOYMENT_ID: process.env.VERCEL_DEPLOYMENT_ID ?? 'local',
  },
  partialPrefetching: false,
  reactStrictMode: false,
  turbopack: {
    rules: {
      '*.svg': {
        loaders: ['@svgr/webpack'],
        as: '*.js',
      },
    },
  },
  images: {
    remotePatterns: [
      {
        hostname: 'static.wsky.dev',
        pathname: '/branding/**',
      },
      ...(await getSponsorImageRemotePatterns()),
    ],
    formats: ['image/avif', 'image/webp'],
  },
  redirects: async () => [
    {
      source: '/lookup',
      destination: '/',
      permanent: true,
    },
  ],
  headers: async () => [
    {
      source: '/:path*',
      headers: [
        {
          key: 'X-Frame-Options',
          value: 'SAMEORIGIN',
        },
        {
          key: 'X-Content-Type-Options',
          value: 'nosniff',
        },
      ],
    },
  ],
  experimental: {
    staleTimes: {
      dynamic: 60,
      static: 300,
    },
  },
  outputFileTracingIncludes: {
    // Tracing keys are picomatch globs — escape the dynamic-segment brackets
    // so they're matched literally instead of as a character class.
    '/lookup/\\[domain\\]/subdomains': ['./bin/subfinder'],
  },
});

export default nextConfig;