esgleam
esbuild for Gleam that works on Erlang & JavaScript.
Quick start
Create a Gleam project as you would normally and make sure you have a file in
srcwith the name of your project (as specified ingleam.toml)Install
esbuildgleam run -m esgleam/install
3.
gleam run -m esgleam/bundle
See /dist for your bundled code
-
To start a development server
gleam run -m esgleam/serve
Advanced Usage
(Follow steps 1-2)
-
Create
/src/build.gleamwith the followingimport esgleam pub fn main() { esgleam.new("./dist/static") |> esgleam.entry("main.gleam") |> esgleam.bundle }
See esgleam for all config options and their default values.
-
Run your build script
gleam run -m build
CLI overview
Install
Install esbuild.
gleam run -m esgleam/installBundle
Bundle the project into a library with src/{project_name}.gleam as your entry point and ./dist/{project_name}.js as your output file.
gleam run -m esgleam/bundleApp
Bundle the project into a single file to run with src/{project_name}.gleam as your entry point and ./dist/{project_name}.js as your output file.
Similar to just running gleam run.
gleam run -m esgleam/appServe
Starts a dev server, serving the dist directory as /.
gleam run -m esgleam/serveInstallation
If available on Hex this package can be added to your Gleam project:
gleam add esgleamand its documentation can be found at https://hexdocs.pm/esgleam.
Roadmap
-
Create file watcher for
*.gleamwhich runs on both Erlang and JavaScript -
Fix bug with STDOUT/STDERR not being shown when running
esbuildin the erlang target - Write tests for config options
- Add more config options if needed
- Pseudo-SourceMaps until #1341 merges
- Consider creating a way to use plugins
- Hot Module Reloading?????