mote

A gleam executable bundler.

Installation:

erlang_runtimes/
- windows_x64/
  - bin/
  - erts-14.0.1/
  - ...
- linux_x64/
  - bin/
  - erts-14.0.1/
  - ...

Usage:

In your project’s root directory, run mote --runtime <RUNTIME> to pack your project with the given runtime. Add the --target flag (options windows-x64, macos-x64, linux-x64) to pack for a target other than your current environment.

In your gleam.toml file, you can add extra options to strip out unnecessary components (this can net you a 90+% reduction in executable size! Primarily via the lib whitelist) This example setup will reduce your setup to more or less the minimal possible components:

[mote]
bin_whitelist = [
    "erl.exe",
    "launch.escript",
    "launch.exe",
    "no_dot_erlang.boot",
]
erts_bin_whitelist = [
    "beam.smp.dll",
    "erlexec.dll",
]
lib_whitelist = [
    "compiler",
    "kernel",
    "stdlib",
]

This does remove many components of the erlang runtime that might be necessary depending on what you were doing. For example, the lib whitelist is stripping out libraries such as xmerl that are used for xml handling. The erts bin whitelist is removing components such as heart which are presumably necessary for the heartbeat functionality of the erlang runtime. However, for “normal” apps, many of these components should be unnecessary.

Search Document