import type { NextConfig } from 'next'

const nextConfig: NextConfig = {
  transpilePackages: ['@innungsapp/shared'],
  output: 'standalone',
  experimental: {},
  webpack: (config, { dev }) => {
    if (dev) {
      // Avoid filesystem cache writes on very low-disk dev machines (ENOSPC).
      config.cache = false
    }
    return config
  },
  // Serve uploaded files
  async rewrites() {
    return [
      {
        source: '/uploads/:path*',
        destination: '/api/uploads/:path*',
      },
    ]
  },
}

export default nextConfig
