56 breaking releases

Uses new Rust 2024

new 0.135.0 Jun 8, 2026
0.133.0 May 26, 2026
0.123.0 Mar 30, 2026
0.106.0 Dec 29, 2025
0.79.1 Jul 31, 2025

#21 in #javascript-linter

Download history 263/week @ 2026-03-03 2563/week @ 2026-03-10 3015/week @ 2026-03-17 2004/week @ 2026-03-24 1278/week @ 2026-03-31 1798/week @ 2026-04-07 1537/week @ 2026-04-14 1350/week @ 2026-04-21 880/week @ 2026-04-28 1542/week @ 2026-05-05 2655/week @ 2026-05-12 4079/week @ 2026-05-19 3268/week @ 2026-05-26 2382/week @ 2026-06-02

12,832 downloads per month

MIT license

1.5MB
26K SLoC

Oxc Minify

See usage instructions.

This is alpha software and may yield incorrect results, feel free to submit a bug report.

Performance and Compression Size

See minification-benchmarks for details.

The current version already outperforms esbuild, but it still lacks a few key minification techniques such as constant inlining and dead code removal, which we plan to implement next.

Caveats

To maximize performance, oxc-minify assumes the input code is semantically correct. It uses oxc-parser's fast mode to parse the input code, which does not check for semantic errors related to symbols and scopes.

API

Functions

// Synchronous minification
minifySync(
  filename: string,
  sourceText: string,
  options?: MinifyOptions,
): MinifyResult

// Asynchronous minification
minify(
  filename: string,
  sourceText: string,
  options?: MinifyOptions,
): Promise<MinifyResult>

Use minifySync for synchronous minification. Use minify for asynchronous minification, which can be beneficial in I/O-bound or concurrent scenarios, though it adds async overhead.

Example

import { minifySync } from "oxc-minify";

const filename = "test.js";
const code = "const x = 'a' + 'b'; console.log(x);";
const options = {
  compress: {
    target: "esnext",
  },
  mangle: {
    toplevel: false,
  },
  codegen: {
    removeWhitespace: true,
  },
  sourcemap: true,
};
const result = minifySync(filename, code, options);
// Or use async version: const result = await minify(filename, code, options);

console.log(result.code);
console.log(result.map);

Assumptions

oxc-minify makes some assumptions about the source code.

See https://github.com/oxc-project/oxc/blob/main/crates/oxc_minifier/README.md#assumptions for details.

Supports WASM

See https://stackblitz.com/edit/oxc-minify for usage example.

Dependencies

~10MB
~191K SLoC