Building · 7 min
How to make a static production build
Vite, plain HTML, Next.js, Phaser, three.js, Godot and Unity — the exact settings.
A static build is your game compiled into plain files a browser can load directly. STAIGE runs your build command inside an isolated container, grabs the output folder, scans it, and serves it from our games CDN.
Vite (React, Phaser, three.js, vanilla)
// vite.config.js
export default { base: "./" }
// package.json
"scripts": { "build": "vite build" } // → dist/Plain HTML / JS
Nothing to build! Keep index.html in the repo root (or tell us the folder). We serve it as-is.
Next.js
// next.config.js — only works if you don't use API routes / server actions
module.exports = { output: "export", images: { unoptimized: true } } // → out/Godot 4
- Project → Export → Add… → Web.
- Export to a folder like
build/web/and commit that folder. - Tell STAIGE the output folder (
build/web). Tip: disable 'Thread Support' for widest browser compatibility.
Unity
- File → Build Settings → WebGL → Build.
- Commit the build folder (contains
index.htmlandBuild/). - Use Gzip or Brotli compression with 'Decompression Fallback' enabled.
Python / native games
Pygame can run in the browser via pygbag. Otherwise, add a download link (GitHub Release) and STAIGE lists it as a download game.
Prompt: set up a static build
Set up a production static build for this game so it can be hosted as static files. - Use Vite (or keep the current bundler if one exists) with base "./" so it works from any sub-path. - Add "build" to package.json scripts; output should go to dist/. - Make sure all assets (images, audio, fonts, JSON) are imported or placed in public/ so they're copied into dist/. - Run the build and confirm dist/index.html works when opened via a simple static server (npx serve dist). Reply with the final build command and output folder.