From a60c886c1b5400a368f86e3fb0e5ebdd1a5b006f Mon Sep 17 00:00:00 2001 From: xujiang Date: Wed, 9 Jul 2025 09:32:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=85=8D=E7=BD=AE=20Next.js=20=E9=9D=99?= =?UTF-8?q?=E6=80=81=E5=AF=BC=E5=87=BA=E8=A7=A3=E5=86=B3=20CI/CD=20?= =?UTF-8?q?=E9=83=A8=E7=BD=B2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 next.config.mjs 中添加 output: 'export' 配置 - 设置 distDir: 'out' 指定输出目录 - 添加 trailingSlash: true 优化静态文件服务 - 现在构建会生成 frontend/out 目录供 CI/CD 部署使用 修复了 rsync 找不到 frontend/out 目录的问题 --- frontend/next.config.mjs | 3 +++ frontend/tsconfig.json | 22 ++++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/frontend/next.config.mjs b/frontend/next.config.mjs index f5cbc38..7b054f2 100644 --- a/frontend/next.config.mjs +++ b/frontend/next.config.mjs @@ -9,6 +9,9 @@ const nextConfig = { images: { unoptimized: true, }, + output: 'export', + trailingSlash: true, + distDir: 'out', } export default nextConfig diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 4b2dc7b..501b47f 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -1,6 +1,10 @@ { "compilerOptions": { - "lib": ["dom", "dom.iterable", "esnext"], + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "allowJs": true, "target": "ES6", "skipLibCheck": true, @@ -19,9 +23,19 @@ } ], "paths": { - "@/*": ["./*"] + "@/*": [ + "./*" + ] } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], - "exclude": ["node_modules"] + "include": [ + "**/*.ts", + "**/*.tsx", + ".next/types/**/*.ts", + "next-env.d.ts", + "out/types/**/*.ts" + ], + "exclude": [ + "node_modules" + ] }