Gleam v0.34 released with multi-target projects
published on 2024/01/17
Gleam can compile to one of two targets: Erlang or JavaScript. Some packages may only support one of the two targets, possibly because they make use of Erlang features that are not available in JavaScript, or vice versa.
Until now if you added one of these packages as a dependency to your project it meant that your project could no longer be compiled for the other target, even if you only use parts of the dependency that are cross-target.
This issue is now solved! The Gleam compiler now tracks target support at the level of individual expressions, so if you only use code that supports the target you are using then your project will compile successfully.