import type { NextConfig } from "next";
import createNextIntlPlugin from "next-intl/plugin";
import path from "path";

const withNextIntl = createNextIntlPlugin("./src/i18n/request.ts");

const nextConfig: NextConfig = {
  output: "standalone",
  reactStrictMode: true,
  allowedDevOrigins: ["my.gosec.cloud", "my.gosec.internal"],
  transpilePackages: ["@gsc/web-kit", "@limitless/ui", "@gsc/chat"],
  // Tracing root must point at the monorepo root (/srv/k8s) so the
  // standalone bundle picks up the file: deps. From /srv/k8s/web/gscMy
  // that's `../..` — `../../..` would resolve to /srv (one level
  // too high).
  outputFileTracingRoot: path.join(__dirname, "../.."),
  turbopack: {
    root: path.join(__dirname, "../.."),
  },
  typescript: {
    // TODO: Fix type errors and remove this
    ignoreBuildErrors: true,
  },
  experimental: {
    serverActions: {
      bodySizeLimit: "2mb",
    },
  },
};

export default withNextIntl(nextConfig);
