Skip to content

Commit 4e2e25a

Browse files
committed
init
1 parent b924d50 commit 4e2e25a

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

.github/workflows/nextjs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ jobs:
7575
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
7676
- name: Build with Next.js
7777
run: ${{ steps.detect-package-manager.outputs.runner }} next build
78+
- name: Static HTML export with Next.js
79+
run: ${{ steps.detect-package-manager.outputs.runner }} next export || echo "next export is not needed with Next.js 13.3+"
7880
- name: Upload artifact
7981
uses: actions/upload-pages-artifact@v3
8082
with:

next.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import type { NextConfig } from "next";
22

33
const nextConfig: NextConfig = {
44
/* config options here */
5+
output: 'export', // 添加静态输出配置,生成静态HTML文件
6+
basePath: '', // 如果项目不在子目录下可以保持为空
57
images: {
68
remotePatterns: [
79
{
@@ -21,6 +23,7 @@ const nextConfig: NextConfig = {
2123
},
2224
],
2325
dangerouslyAllowSVG: true,
26+
unoptimized: true, // 为了静态导出,禁用服务器端图像优化
2427
},
2528
};
2629

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"devDependencies": {
4343
"@tailwindcss/postcss": "^4",
4444
"@types/node": "^20",
45-
"@types/react": "^19",
45+
"@types/react": "^init",
4646
"@types/react-dom": "^19",
4747
"prettier": "^3.5.3",
4848
"tailwindcss": "^4",

0 commit comments

Comments
 (0)