#minify #javascript #js #minification

build esbuild-rs

Rust wrapper for esbuild, an extremely fast JS minifier written in Go

18 releases

0.13.8 Oct 23, 2021
0.12.19 Aug 8, 2021
0.8.30 Jan 7, 2021
0.2.1 Jul 25, 2020
0.0.8 Jul 19, 2020

#302 in Build Utils

Download history 5/week @ 2024-07-20 7/week @ 2024-07-27 4/week @ 2024-08-03 27/week @ 2024-08-10 5/week @ 2024-08-17 5/week @ 2024-08-24 4/week @ 2024-08-31 9/week @ 2024-09-14 52/week @ 2024-09-21 12/week @ 2024-09-28 5/week @ 2024-10-05 15/week @ 2024-10-12 18/week @ 2024-10-19 11/week @ 2024-10-26 14/week @ 2024-11-02

59 downloads per month
Used in 3 crates (via hyperbuild)

MIT license

2MB
47K SLoC

Go 45K SLoC // 0.1% comments Rust 1K SLoC // 0.0% comments

esbuild-rs

Rust wrapper for esbuild using FFI and Cgo. esbuild is an extremely fast JavaScript minifier written in Go.

Using

This library requires Go 1.13 or higher. The Go source is included and compiled at build time. The build will not interfere with or create files in GOROOT or GOPATH, or download any Go dependencies.

Check the docs for the API.

Async

A fork of esbuild is used to allow taking advantage of the Go scheduler for optimal concurrency. Friendly functions that use Futures are available, which are suitable for most cases; for advanced usage, direct functions that take a callback and return immediately are also available, requiring additional concurrency management on top.

Windows

Since Cgo uses GCC, a GCC compiler is required to compile the Go library, even if the MSVC Rust toolchain is used. TDM-GCC is recommended.

If the msvc toolchain is used, this library will compile a DLL, embed it into the resulting Rust binary, and load it at runtime from memory using MemoryModule. This happens transparently at build time and run time, and requires no extra effort.

Dependencies