Extremely fast JavaScript minifier written in Rust, with Node.js bindings. Current stable version is 0.7.0. This is a fork of the unmaintained minify-js package, aiming to provide maximum performance on a single CPU core using SIMD instructions and a bump allocation arena. It supports JSX, scope analysis, identifier minification, and various AST transformations (e.g., converting if statements to expressions, transforming functions to arrow functions). Unlike UglifyJS or Terser, it focuses on raw speed and simplicity over configurability or bundling; it does not offer extensive options or plugin systems. Release cadence is irregular; the package ships TypeScript type definitions, so no separate @types package is needed.
npm install better-minify-js-nodeNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Reads a JavaScript file, minifies it using better-minify-js-node, and writes the minified output to a new file.
Wrap your string in Buffer.from(input, 'utf-8') before passing to minify().
Simply call minify(buffer) without a second argument.
Remove comments from input if needed, or use an alternative if you must retain comments.
Test your JSX input thoroughly; consider disabling JSX minification if errors occur.
Replace 'minifySync' with 'minify'.
Ensure you pass a Buffer: const buffer = Buffer.from(code, 'utf-8');
Validate your JavaScript code or remove TypeScript syntax. The minifier only supports standard JS and JSX.
Convert string to buffer: const buffer = Buffer.from(code, 'utf-8');
No dependency data recorded yet.