A small wrapper around the Gleam build script for use with esbuild.
This plugin assumes that there is a gleam
executable available on the current PATH. Installation instructions are available on the Gleam website.
To use this esbuild plugin, you will need to use the JavaScript API. For an example of a complete setup, see the examples
directory.
You'll want to:
-
Add this plugin to your package's dependencies:
$ npm install https://github.com/jim/esbuild-plugin-gleam
-
Add the GleamPlugin to your esbuild script (for example,
build.js
):import esbuild from 'esbuild'; import { GleamPlugin } from 'esbuild-plugin-gleam'; esbuild.build({ entryPoints: ['src/index.js'], bundle: true, outdir: 'dist', plugins: [ GleamPlugin() ] }).catch(_e => process.exit(1));
-
Add the build script to
package.json
:"scripts": { "build": "node ./build.js", },
-
Add the following to the top level of your
package.json
file:"gleamDependencies": [ { "name": "gleam_stdlib", "ref": "main", "url": "https://github.com/gleam-lang/stdlib.git" }, { "name": "gleam_javascript", "ref": "main", "url": "https://github.com/gleam-lang/javascript.git", "dependencies": [ "gleam_stdlib" ] } ]
-
Run
npm run build
to build your project.