/** @type {import('next').NextConfig} */
import {NextConfig} from "next";

const nextConfig: NextConfig = {
  // 关闭构建时的 TypeScript 检查
  typescript: {
    ignoreBuildErrors: true,
  },
  // 关闭构建时的 ESLint 检查
  eslint: {
    ignoreDuringBuilds: true,
  },

  // 代理重定向到后台服务
  async rewrites() {
    return {
      fallback: [
        {
          source: "/api/system/user",
          destination: `${process.env.BACKEND_URL}/system/user/`,
        },
        {
          source: "/api/:path*",
          destination: `${process.env.BACKEND_URL}/:path*`,
        },
      ],
    };
  },

  images: {
    dangerouslyAllowSVG: true,
    contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
    remotePatterns: [
      {
        protocol: "https",
        hostname: "img.shields.io",
        port: "",
        pathname: "/**",
      },
    ],
  },
};

module.exports = nextConfig;
