feat(azure): apply Azure SWA best practices for Next.js

- Add standalone output mode in next.config.mjs
- Configure environment variables with .env.example
- Update staticwebapp.config.json with proper routing and fallback
- Optimize GitHub Actions workflow with npm cache and env vars
- Set output_location to .next/standalone for SWA deployment
- Preserve all business logic in API client, auth, and components
This commit is contained in:
xiaohei
2025-12-29 07:58:24 +00:00
parent 1b6c528be0
commit 00aef0bea8
3 changed files with 61 additions and 3 deletions
+12
View File
@@ -1,11 +1,23 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
// Azure SWA 最佳实践:输出独立服务器模式
output: 'standalone',
typescript: {
ignoreBuildErrors: true,
},
images: {
unoptimized: true,
},
// 环境变量配置
env: {
NEXT_PUBLIC_DATA_INGESTION_URL: process.env.NEXT_PUBLIC_DATA_INGESTION_URL,
NEXT_PUBLIC_MCP_SERVER_URL: process.env.NEXT_PUBLIC_MCP_SERVER_URL,
NEXT_PUBLIC_API_GATEWAY_URL: process.env.NEXT_PUBLIC_API_GATEWAY_URL,
},
async redirects() {
return [
{