To enable Gleam support in your Elixir project, update your mix.exs file with the following configuration. This allows Mix to use the Gleam compiler and manage Gleam dependencies.
Required Configuration
Add mix_gleam to your archives, add :gleam to your compilers, and update your aliases to include gleam.deps.get.
Note on erlc_paths:
- For Gleam < v0.25.0, include
"build/dev/erlang/#{@app}/build". - For Gleam >= v0.25.0, use
"build/dev/erlang/#{@app}/_gleam_artefacts".
Note on prune_code_paths:
- For Elixir >= v1.15.0, you must set
prune_code_paths: false in your project function.
Full Example Configuration
# in mix.exs
# ...
@app :my_gleam_app
def project do
[
app: @app,
# ...
archives: [mix_gleam: "~> 0.6"],
compilers: [:gleam | Mix.compilers()],
aliases: [
# Or add this to your aliases function
"deps.get": ["deps.get", "gleam.deps.get"]
],
erlc_paths: [
"build/dev/erlang/#{@app}/_gleam_artefacts",
# For Gleam < v0.25.0
"build/dev/erlang/#{@app}/build"
],
erlc_include_path: "build/dev/erlang/#{@app}/include",
# For Elixir >= v1.15.0
prune_code_paths: false,
# ...
]
end
# ...
# in mix.exs
# ...
@app :my_gleam_app
def project do
[
app: @app,
# ...
archives: [mix_gleam: "~> 0.6"],
compilers: [:gleam | Mix.compilers()],
aliases: [
# Or add this to your aliases function
"deps.get": ["deps.get", "gleam.deps.get"]
],
erlc_paths: [
"build/dev/erlang/#{@app}/_gleam_artefacts",
# For Gleam < v0.25.0
"build/dev/erlang/#{@app}/build"
],
erlc_include_path: "build/dev/erlang/#{@app}/include",
# For Elixir >= v1.15.0
prune_code_paths: false,
# ...
]
end
# ...