Skip to content

fix(webgl): strip the bundled native server from the WebGL build output#124

Merged
marceld23 merged 1 commit into
mainfrom
fix/webgl-strip-bundled-server
Jun 29, 2026
Merged

fix(webgl): strip the bundled native server from the WebGL build output#124
marceld23 merged 1 commit into
mainfrom
fix/webgl-strip-bundled-server

Conversation

@marceld23

Copy link
Copy Markdown
Owner

Summary

A WebGL build was including the desktop bundled native server (StreamingAssets/server/BlocksBeyondTheStars.GameServer.exe + .pdb, ~70 MB). Unity copies the whole StreamingAssets/ folder into every build, so if a prior desktop build left StreamingAssets/server/ in the project, it got baked into the WebGL bundle too.

  • A browser can never run a native server, and it is not in the content manifest (so players never fetch it) — but it bloats the web bundle and ships a stray platform binary.
  • BuildScript.BuildWebGL now deletes <output>/StreamingAssets/server after the build. Only the build output is touched; the source project keeps the bundled server so a later desktop Singleplayer build/run still finds it.

Scope / impact

  • CI was already clean (fresh checkout + the WebGL job does not run publish-local-server); this hardens local builds where a prior desktop build populated StreamingAssets/server/.
  • BuildScript.cs is Unity editor code (not compiled by the .NET CI), so this is verified by inspection + a local WebGL build. The change uses only already-imported namespaces and is a guarded Directory.Delete.

Re #121.

🤖 Generated with Claude Code

On desktop the client launches a bundled native server for Singleplayer/Host,
so a prior desktop build leaves StreamingAssets/server/ in the project. Unity
copies the whole StreamingAssets folder into every build, so the ~70 MB Windows
server (.exe + .pdb) was being baked into WebGL builds too. A browser can never
run it (and it is not in the content manifest, so players never fetch it), but
it bloats the web bundle and ships a stray platform binary.

BuildScript.BuildWebGL now deletes <output>/StreamingAssets/server after the
build. Only the build OUTPUT is touched; the source project keeps the bundled
server so a later desktop Singleplayer build/run still finds it. CI builds were
already clean (fresh checkout, no publish-local-server in the WebGL job); this
hardens local builds. Re #121.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@marceld23 marceld23 merged commit 3b25126 into main Jun 29, 2026
12 checks passed
@marceld23 marceld23 deleted the fix/webgl-strip-bundled-server branch June 29, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant