esgleam
Types
Config for esbuild
pub type Config {
Config(
outdir: String,
entry_points: List(String),
format: Format,
minify: Bool,
target: List(String),
serve: Option(String),
sourcemap: Bool,
watch: Bool,
raw: String,
)
}
Constructors
-
Config( outdir: String, entry_points: List(String), format: Format, minify: Bool, target: List(String), serve: Option(String), sourcemap: Bool, watch: Bool, raw: String, )
Arguments
-
outdir
Output directory
-
entry_points
List of entry points supplied
-
format
Output format for JavaScript. See
Format
defaultEsm
-
minify
default
False
-
target
List of target environments
default[]
-
serve
The root directory for the dev server (run server when defined)
defaultNone
-
sourcemap
Generate sourcemap for JavaScript
defaultFalse
-
watch
Enable watchmode. Bundles files on change
Note:gleam build
need to be run manually
defaultFalse
-
raw
raw flags to pass to esbuild
default""
-
Functions
pub fn entry(config: Config, path: String) -> Config
Entry points
Can be use multiple times
pub fn new(outdir path: String) -> Config
Start to create a build script
> esbuild.new("./dist/static")
Config("./dist/static", ...)
pub fn serve(config: Config, dir path: String) -> Config
Start a development server on http://127.0.0.1:8000 with path
being /
pub fn target(config: Config, target: String) -> Config
Target for transpiled JavaScript. Can be used mutiple times
> esbuild.new("./dist/static")
> |> esbuild.target("es2020")
> |> esbuild.target("firefox110")
> |> esbuild.target("edge90")