Yes, there are two parts to the engine, building the editor which you may be familiar with, and building the runtime templates. The latter is a slightly smaller executable that runs PCK and zip files of compressed godot project files, creating packs is largely what the “Export” menu does, then a runtime template is copied into the exported directory.
You can build your own runtime template from the Godot source code using scons target=template_release, and if the template is copied into the correct export_templates folder can be exported through the usual editor dialogue
| Platform | Path |
|---|---|
| Windows | %APPDATA%\Godot\export_templates\<version number> |
| macOS | ~/Library/Application Support/Godot/export_templates/<version number> |
| Linux | ~/.local/share/godot/export_templates/<version number> |
popcar2 posted on how they minimized their godot build for web specifically, more of a journey blog than a how-to, but I could see this being easier to follow each command and why the options matter.
Worth noting this only affects the runtime’s size, if you have large assets then the assets will still take up a majority of the pack size.