Extremely fast JavaScript minifier, written in Rust.
Comparison with esbuild, run on common libraries.
new
, this
, arguments
, and prototype
aren't used.if
statements to expressions.Precompiled binaries are available for Linux, macOS, and Windows.
Linux x64 | macOS x64 | Windows x64
Use the --help
argument for more details.
minify-js --output /path/to/output.min.js /path/to/src.js
Add the dependency:
[dependencies] minify-js = "0.6.0"
Call the method:
use minify_js::{Session, TopLevelMode, minify}; let mut code: &[u8] = b"const main = () => { let my_first_variable = 1; };"; let session = Session::new(); let mut out = Vec::new(); minify(&session, TopLevelMode::Global, code, &mut out).unwrap(); assert_eq!(out.as_slice(), b"const main=()=>{let a=1}");
Install the dependency:
Call the method:
import {minify} from "@minify-js/node"; const src = Buffer.from("let x = 1;", "utf-8"); const min = minify(src);
import { "a-b" as "c-d" } from "x"
.x === null || x === undefined
with x == null
, where x
is side-effect free.typeof x === "undefined"
with x === undefined
.void x
with x, undefined
.return undefined
with return
.const
with let
.let
and const
.if (...) return a; else if (...) return b; else return c
=> return (...) ? a : (...) ? b : c
.RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4