/** @type {import('next').NextConfig} */
const nextConfig = {
  images: {
    remotePatterns: [
      {
        protocol: 'http', // для локал девеломпента
        hostname: '127.0.0.1',
        port: '8000',
        pathname: '**',
      },
    ],
  },
  outputFileTracingExcludes: {
    './**': ['./assets/big-models/**/*'],
  },
  async rewrites() {
    const backend = process.env.BACKEND_URL || 'http://127.0.0.1:8000/api/v1'
    return [
      {
        source: '/static-models/:path*',
        destination: '/api/big-models/:path*',
      },
      {
        source: '/api/v1/account/user',
        destination: `${backend}/account/user/`,
      },
      {
        source: '/api/v1/:path*',
        destination: `${backend}/:path*`,
      },
    ]
  },
  experimental: {
    webpackBuildWorker: false,
  },
}

module.exports = nextConfig
