esgleam

Package VersionHex Docs

esbuild for Gleam that works on Erlang & JavaScript.

Quick start

  1. Create a Gleam project as you would normally.

  2. Install esbuild (note: you will have to rerun this if your build directory gets wiped. i.e. after gleam clean)

    $ gleam run -m esgleam/install
  3. Create /src/build.gleam with the following

    import esgleam
    
    pub fn main() {
    esgleam.new("./dist/static")
    |> esgleam.entry("main.gleam")
    |> esgleam.target("esnext")
    |> esgleam.target("firefox110")
    |> esgleam.bundle
    }
  4. Build for JavaScript

    $ gleam build --target=javascript
  5. Run your build script (in any target)

    $ gleam run -m build

Installation

If available on Hex this package can be added to your Gleam project:

gleam add esgleam

and its documentation can be found at https://hexdocs.pm/esgleam.

Roadmap