Cloudflare / itch.io
This content is not available in your language yet.
Web 版游戏可以发布到支持静态文件托管的平台,如 Cloudflare Pages、GitHub Pages、Netlify、Vercel 等,或专门的 HTML5 游戏平台如 itch.io。
在阅读以下指南前,请确保已经使用 npm run engine:pack -- --target=web --compress 命令打包了 Web 版本游戏。
发布到 Cloudflare Pages
Section titled “发布到 Cloudflare Pages”- 在 Cloudflare Dashboard 中创建一个新的 Pages 项目
- 连接你的 Git 仓库,或选择「直接上传」
- 若使用直接上传,将
game/目录中的全部文件或单个压缩包上传即可 - 若通过 Git 集成,在构建设置中填写:
- 构建命令:
npm run engine:pack -- --target=web --output=./out - 输出目录:
out/game
- 构建命令:
发布到 itch.io
Section titled “发布到 itch.io”- 登录 itch.io,进入你的游戏页面,选择「Edit game」
- 在「Uploads」部分点击「Upload files」,上传
game.zip(使用--compress参数生成) - 勾选上传文件旁的 「This file will be played in the browser」
- 在「Kind of project」中选择 HTML
- 保存并发布