From 5d22080d9357a14a5114d2ecf8411c12159a8979 Mon Sep 17 00:00:00 2001 From: shenlan Date: Wed, 18 Jun 2025 20:47:24 +0800 Subject: [PATCH] fix: update next export workflow --- docs/ui/nextjs-admin-panel.md | 10 +++++----- ui/homepage/Makefile | 4 ++-- ui/homepage/package.json | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/ui/nextjs-admin-panel.md b/docs/ui/nextjs-admin-panel.md index da578f8..6a0d166 100644 --- a/docs/ui/nextjs-admin-panel.md +++ b/docs/ui/nextjs-admin-panel.md @@ -38,10 +38,10 @@ styles/ ```ts export const dynamic = 'force-static' ``` -- 使用 `next export` 生成静态 HTML: - ```bash - npm run build && npx next export - ``` + - 在 `next.config.js` 中设置 `output: 'export'`,只需执行: + ```bash + npm run build + ``` 生成的 `out/` 目录即可作为纯静态网站部署。 @@ -54,7 +54,7 @@ styles/ 布局组件 `layout.tsx` 中使用 React 状态切换侧边栏,可满足主流移动端浏览体验。 ## 示例代码结构 -本仓库 `ui/nextjs` 目录提供了一套最简参考实现,可直接 `npm run build && npx next export` 编译到 `ui/dist` 供 Go 服务嵌入。 +本仓库 `ui/nextjs` 目录提供了一套最简参考实现,只需 `npm run build` 即可编译到 `ui/dist` 供 Go 服务嵌入。 ## macOS 本地开发调试 `ui/nextjs` 目录下新增的 `Makefile` 可在 macOS 环境一键执行常见任务: diff --git a/ui/homepage/Makefile b/ui/homepage/Makefile index 41ebb2a..e886369 100644 --- a/ui/homepage/Makefile +++ b/ui/homepage/Makefile @@ -23,8 +23,8 @@ build: yarn next build export: - @echo "📦 Exporting homepage static site to ./out ..." - yarn next build && yarn next export + @echo "📦 Exporting homepage static site to ./out ..." + yarn next build clean: @echo "🧹 Cleaning .next and out directories..." diff --git a/ui/homepage/package.json b/ui/homepage/package.json index 37ed22b..cae485e 100644 --- a/ui/homepage/package.json +++ b/ui/homepage/package.json @@ -5,7 +5,7 @@ "scripts": { "dev": "next dev", "build": "next build", - "export": "next export", + "export": "next build", "start": "next start", "lint": "next lint" },