A lightweight Node.js server for serving Unity WebGL builds with precompressed assets (Brotli / Gzip), designed for fast local development and minimal runtime overhead.
This is a modified fork of serve-unity, tailored for modern Unity WebGL builds that already output .br files.
- Serves precompressed Unity WebGL builds (
.br,.gz) without runtime recompression. - Correctly sets
Content-EncodingandContent-Typeheaders for Unity assets:.wasm.br→application/wasm.js.br→application/javascript.data.br→application/octet-stream
- Serves the current working directory, making it easy to run from anywhere.
- Optional fallback to precompressed variants when available (e.g. serve
foo.wasm.brfor afoo.wasmrequest if the client supports Brotli). - Zero external dependencies beyond Node.js.
- Designed for local development and simple static hosting workflows.
- Removed dynamic on-the-fly Brotli/Gzip compression (avoids unnecessary CPU usage).
- Optimized for Unity WebGL builds that already generate precompressed assets.
- Removed promotional messages and external upload links.
- Renamed CLI to avoid clashing with the upstream package.
Choose one of the following installation methods:
Install the CLI globally from the GitHub repository:
npm install -g git+https://github.com/MangkorN/serve-unity-mod.gitThis installs
serve-unity-modinto your system without needing to clone the repository locally. To update, re-run the install command. If npm keeps the older commit, runnpm uninstall -g serve-unity-modfirst, then install again.
Clone or unzip this repository, then run:
npm install
npm linkThis creates a global command that points to your local working copy. Changes take effect immediately (linked to your working copy).
Clone or unzip this repository, then run:
npm install
npm install -g .This installs a snapshot of the local repository globally. Re-run
npm install -g .to pick up changes.
Run the server in the directory containing your Unity WebGL build:
serve-unity-mod <port>Example:
cd Build/
serve-unity-mod 9000Then open:
http://localhost:9000- If no port is specified, the server defaults to 9000.
- The server always serves the current working directory.
- Precompressed files (.br, .gz) are served as-is with correct headers.
mygame.data.br
mygame.framework.js.br
mygame.wasm.br
mygame.loader.jsThis is the standard output for Unity WebGL builds using Brotli compression.
MIT License.
This project is a modified derivative of the original serve-unity project. Original copyright and license notices are preserved.
- Original project by Rocco Balsamo
- Modifications by Mangkorn Yuan