Compiling for the Web
See also Exporting for the Web.
Requirements
To compile export templates for the Web, the following is required:
- Emscripten 1.39.9+.
- Python 3.5+.
- SCons 3.0+ build system.
See also
Getting the source.
Introduction to the buildsystem.
Building export templates
emccis available in your PATH. This is usually configured by the Emscripten SDK, e.g. when invokingemsdk activateandsource ./emsdk_env.sh/emsdk_env.bat.targetas eitherreleasefor a release build orrelease_debugfor a debug build:
JavaScript singleton will be built into the engine. Official export templates also have the JavaScript singleton enabled. Sincescons platform=javascript tools=no target=releasescons platform=javascript tools=no target=release_debug
eval()calls can be a security concern, thejavascript_evaloption can be used to build without the singleton:scons platform=javascript tools=no target=release javascript_eval=noscons platform=javascript tools=no target=release_debug javascript_eval=no
binsubdirectory. Its name isgodot.javascript.opt.zipfor release orgodot.javascript.opt.debug.zipfor debug.webassembly_release.zipfor the release template:mv bin/godot.javascript.opt.zip bin/webassembly_release.zip
webassembly_debug.zipfor the debug template:mv bin/godot.javascript.opt.debug.zip bin/webassembly_debug.zip
Threads and GDNative
export page for more info.threads_enabled=yesorgdnative_enabled=yesto enable threads or GDNative support:scons platform=javascript tools=no threads_enabled=yes target=releasescons platform=javascript tools=no threads_enabled=yes target=release_debugscons platform=javascript tools=no gdnative_enabled=yes target=releasescons platform=javascript tools=no gdnative_enabled=yes target=release_debug
binsubdirectory. Its name will have either the.threadsor.gdnativesuffix.webassembly_release_threads.zipandwebassembly_release_gdnative.zipfor the release template:mv bin/godot.javascript.opt.threads.zip bin/webassembly_threads_release.zipmv bin/godot.javascript.opt.gdnative.zip bin/webassembly_gdnative_release.zip
webassembly_debug_threads.zipandwebassembly_debug_gdnative.zipfor the debug template:mv bin/godot.javascript.opt.debug.threads.zip bin/webassembly_threads_debug.zipmv bin/godot.javascript.opt.debug.gdnative.zip bin/webassembly_gdnative_debug.zip
Building the Editor
It is also possible to build a version of the Godot editor that can run in the browser. The editor version requires threads support and is not recommended over the native build. You can build the editor with:scons platform=javascript tools=yes threads_enabled=yes target=release_debug
binsubdirectory. Its name will begodot.javascript.opt.tools.threads.zip. You can upload the zip content to your web server and visit it with your browser to use the editor. export page for the web server requirements.
