Butternut is an experimental ES2015-aware JavaScript minifier that uses a novel approach: instead of manipulating an AST, it edits code in place using magic-string, resulting in significantly faster minification. It is typically 3x faster than UglifyJS and 10-15x faster than Babili. However, it is alpha software (v0.4.6) and should be thoroughly tested before production use. It supports the check option to parse output for correctness. Note: the package is deprecated; users are advised to migrate to modern minifiers like terser or uglify-es.
npm install butternutNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Minify a simple JavaScript string using butternut.squash with the check option enabled.
Migrate to terser (npm install terser) or uglify-es.
Always use the check option to validate output, or switch to a stable minifier.
Use npx butternut or local installation.
Use default import or require; no named imports except squash.
npm install butternut --save-dev
Use require('butternut') or import butternut from 'butternut'.Ensure input is a string and options object is correct; check for errors.