import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  // 允许跨域请求后端 API
  async rewrites() {
    return [
      {
        source: '/api/:path*',
        destination: 'http://localhost:8006/api/:path*',  // 服务器本地代理
      },
      {
        source: '/uploads/:path*',
        destination: 'http://localhost:8006/uploads/:path*',  // 转发上传的素材
      },
      {
        source: '/outputs/:path*',
        destination: 'http://localhost:8006/outputs/:path*',  // 转发生成的视频
      },
      {
        source: '/assets/:path*',
        destination: 'http://localhost:8006/assets/:path*',  // 转发静态资源（字体/音乐）
      },
    ];
  },
};

export default nextConfig;
