Compiling for the Web

    This page describes how to compile HTML5 editor and export template binaries from source. If you’re looking to export your project to HTML5 instead, read Exporting for the Web.

    To compile export templates for the Web, the following is required:

    See also

    For a general overview of SCons usage for Godot, see .

    Before starting, confirm that is available in your PATH. This is usually configured by the Emscripten SDK, e.g. when invoking emsdk activate and source ./emsdk_env.sh/emsdk_env.bat.

    Open a terminal and navigate to the root directory of the engine source code. Then instruct SCons to build the JavaScript platform. Specify target as either release for a release build or release_debug for a debug build:

    By default, the will be built into the engine. Official export templates also have the JavaScript singleton enabled. Since eval() calls can be a security concern, the javascript_eval option can be used to build without the singleton:

    The engine will now be compiled to WebAssembly by Emscripten. Once finished, the resulting file will be placed in the bin subdirectory. Its name is godot.javascript.opt.zip for release or godot.javascript.opt.debug.zip for debug.

    Finally, rename the zip archive to webassembly_release.zip for the release template:

    1. mv bin/godot.javascript.opt.debug.zip bin/webassembly_debug.zip

    The default export templates do not include threads and GDNative support for performance and compatibility reasons. See the for more info.

    You can build the export templates using the option threads_enabled=yes or gdnative_enabled=yes to enable threads or GDNative support:

    Once finished, the resulting file will be placed in the bin subdirectory. Its name will have either the or .gdnative suffix.

    Finally, rename the zip archives to webassembly_release_threads.zip and webassembly_release_gdnative.zip for the release template:

    1. mv bin/godot.javascript.opt.threads.zip bin/webassembly_threads_release.zip

    And webassembly_debug_threads.zip and webassembly_debug_gdnative.zip for the debug template:

    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:

    1. scons platform=javascript tools=yes threads_enabled=yes target=release_debug

    Refer to the for the web server requirements.