498bb3a3c8
- Move CI/CD configs to config/ci/ directory - Reorganize scripts into categorized directories (deployment, monitoring, testing, utils) - Consolidate documentation into docs/ directory with proper structure - Update linting and testing configurations - Remove obsolete test reports and performance summaries - Add new documentation for code quality tools and contact form security - Improve project organization and maintainability - Fix lint-staged config to only lint JS/TS files - Disable react/react-in-jsx-scope rule for Next.js compatibility - Ignore scripts and test config directories in ESLint
48 lines
1.3 KiB
Bash
Executable File
48 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
echo "🧪 测试Contact页面HMR错误"
|
|
echo "=========================="
|
|
echo ""
|
|
|
|
# 颜色定义
|
|
GREEN='\033[0;32m'
|
|
RED='\033[0;31m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# 检查开发服务器是否运行
|
|
if ! lsof -ti:3000 > /dev/null 2>&1; then
|
|
echo -e "${RED}❌ 开发服务器未运行${NC}"
|
|
echo "请先运行: npm run dev"
|
|
exit 1
|
|
fi
|
|
|
|
echo -e "${GREEN}✅ 开发服务器正在运行${NC}"
|
|
echo ""
|
|
|
|
# 测试contact页面
|
|
echo "测试Contact页面..."
|
|
echo "访问: http://localhost:3000/contact"
|
|
echo ""
|
|
|
|
# 使用curl测试页面
|
|
response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/contact)
|
|
|
|
if [ "$response" -eq 200 ]; then
|
|
echo -e "${GREEN}✅ Contact页面响应正常 (HTTP $response)${NC}"
|
|
else
|
|
echo -e "${RED}❌ Contact页面响应异常 (HTTP $response)${NC}"
|
|
fi
|
|
|
|
echo ""
|
|
echo "📋 请在浏览器中访问 http://localhost:3000/contact 并检查控制台"
|
|
echo "如果仍然看到HMR错误,请尝试以下方案:"
|
|
echo ""
|
|
echo "1. 清除浏览器缓存"
|
|
echo "2. 使用无痕模式打开"
|
|
echo "3. 运行: ./scripts/fix-dev-server.sh --deep"
|
|
echo "4. 考虑使用生产模式: npm run build && npm run start"
|
|
echo ""
|
|
echo "如果问题持续,建议:"
|
|
echo "- 升级Next.js到15.x: npm install next@^15.0.0"
|
|
echo "- 或降级React到18.x: npm install react@^18.3.0 react-dom@^18.3.0" |