Files
vf_react/fix-nextjs-config.sh
2025-11-22 09:10:13 +08:00

58 lines
1.2 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
echo "修复 Next.js 配置..."
cd /home/ubuntu/vf_react/src/views/AgentChat/neuratalk
# 1. 删除 TypeScript 配置(如果存在)
if [ -f "next.config.ts" ]; then
rm next.config.ts
echo "✓ 删除了 next.config.ts"
fi
# 2. 创建 JavaScript 配置
cat > next.config.js << 'EOF'
/** @type {import('next').NextConfig} */
const nextConfig = {
// 开发环境先不设置 basePath方便测试
// 生产环境再启用basePath: '/ai-chat',
reactStrictMode: true,
poweredByHeader: false,
// 解决多个 lockfile 警告
outputFileTracingRoot: '/home/ubuntu/vf_react/src/views/AgentChat/neuratalk',
// 重写规则
async rewrites() {
return [
{
source: '/api/:path*',
destination: 'http://localhost:5001/api/:path*',
},
{
source: '/mcp/:path*',
destination: 'http://localhost:8900/:path*',
},
];
},
images: {
domains: ['valuefrontier.cn', 'localhost'],
},
};
module.exports = nextConfig;
EOF
echo "✓ 创建了 next.config.js"
# 3. 重启开发服务器
echo ""
echo "请运行以下命令重启服务器:"
echo "npm run dev"
echo ""
echo "然后访问:"
echo "http://localhost:3000"
echo "或"
echo "http://49.232.185.254:3000"