Nextjs项目部署GithubPages

1.开启静态输出

根据官网进行配置:

next.config.js文件里增加:

lua 复制代码
output:'export'

2.项目安装gh-pages

csharp 复制代码
yarn add gh-pages

package.json文件中增加下面部署命令:

json 复制代码
 "homepage": "./",
 "scripts": {
    "deploy": "gh-pages -d build"
  },

3.命令执行

arduino 复制代码
yarn build // 执行之后项目会生成out文件夹
yarn deploy // 执行之后,远程仓库会多出一个gh-pages分支

4.github部署

相关推荐
Gladiator5751 小时前
博客记录-day154-面试
github
Gladiator5751 小时前
博客记录-day155-力扣+面试
github
徐小夕4 小时前
写了一款3D可视化编辑器模版,开源!
前端·javascript·github
uhakadotcom4 小时前
持续写作的“农耕思维”:如何像农民一样播种,收获稳定成长与收入
后端·面试·github
服部5 小时前
如何查看指定作者在所有分支的提交记录
前端·git·github
小华同学ai5 小时前
2.1k star! 抓紧冲,DeepChat:连接AI与个人世界的智能助手的开源项目
人工智能·ai·开源·github·工具
互联网搬砖老肖7 小时前
运维打铁:域名详解及常见问题解决
运维·github
梓羽玩Python12 小时前
7.8K 标星!这个Python神器把MCP服务器变成「搭积木」一样简单!
python·github
a小胡哦12 小时前
TensorFlow深度学习框架:从入门到精通的完整指南
pytorch·python·github·tensorflow
brzhang12 小时前
宝藏发现:Sim Studio,一款让AI工作流搭建变简单的开源利器
前端·后端·github