fix: 配置 Next.js 静态导出解决 CI/CD 部署问题
Some checks failed
Deploy Frontend / deploy (push) Has been cancelled

- 在 next.config.mjs 中添加 output: 'export' 配置
- 设置 distDir: 'out' 指定输出目录
- 添加 trailingSlash: true 优化静态文件服务
- 现在构建会生成 frontend/out 目录供 CI/CD 部署使用

修复了 rsync 找不到 frontend/out 目录的问题
This commit is contained in:
xujiang
2025-07-09 09:32:12 +08:00
parent fe59c8b499
commit a60c886c1b
2 changed files with 21 additions and 4 deletions

View File

@ -9,6 +9,9 @@ const nextConfig = {
images: { images: {
unoptimized: true, unoptimized: true,
}, },
output: 'export',
trailingSlash: true,
distDir: 'out',
} }
export default nextConfig export default nextConfig

View File

@ -1,6 +1,10 @@
{ {
"compilerOptions": { "compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"], "lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true, "allowJs": true,
"target": "ES6", "target": "ES6",
"skipLibCheck": true, "skipLibCheck": true,
@ -19,9 +23,19 @@
} }
], ],
"paths": { "paths": {
"@/*": ["./*"] "@/*": [
"./*"
]
} }
}, },
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], "include": [
"exclude": ["node_modules"] "**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
"next-env.d.ts",
"out/types/**/*.ts"
],
"exclude": [
"node_modules"
]
} }