File tree Expand file tree Collapse file tree 3 files changed +6
-1
lines changed
Expand file tree Collapse file tree 3 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 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 :
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import type { NextConfig } from "next";
22
33const 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
Original file line number Diff line number Diff line change 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" ,
You can’t perform that action at this time.
0 commit comments