/** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: true, turbopack: { root: __dirname, }, images: { remotePatterns: [ { protocol: 'http', hostname: 'localhost', }, ], }, async rewrites() { const apiBase = process.env.NEXT_PUBLIC_API_BASE_URL || 'http://localhost:8000'; return [ { source: '/api/:path*', destination: `${apiBase}/api/:path*`, }, { // 图片等静态资源:后端 /uploads 由 StaticFiles 提供,前端代理过去 // 否则 会请求前端3000端口导致404破图 source: '/uploads/:path*', destination: `${apiBase}/uploads/:path*`, }, ]; }, }; module.exports = nextConfig;