import type { NextConfig } from "next"
import path from "node:path"
import { fileURLToPath } from "node:url"

const __filename = fileURLToPath(import.meta.url)
const projectRoot = path.dirname(__filename)

const nextConfig: NextConfig = {
  typescript: {
    // Pula verificacao de tipos durante build para evitar OOM no servidor de producao
    ignoreBuildErrors: true,
  },
  experimental: {
    turbopackFileSystemCacheForDev: true,
  },
  turbopack: {
    // Define a raiz do projeto para evitar warning de multiplos lockfiles
    root: projectRoot,
  },
  // Pacotes nativos que nao devem ser bundled pelo servidor
  serverExternalPackages: ["better-sqlite3"],
}

export default nextConfig

