esgleam

Package Version Hex Docs

esbuild for Gleam that works on Erlang & JavaScript.

Quick start

  1. Create a Gleam project as you would normally and make sure you have a file in src with the name of your project (as specified in gleam.toml)

  2. Install esbuild

$ gleam run -m esgleam/install
$ gleam run -m esgleam/bundle

See /dist for your bundled code

  1. To start a development server
$ gleam run -m esgleam/serve

Advanced Usage

(Follow steps 1-2)

  1. 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
}
  1. Run your build script
$ 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

Search Document