Registry / devops / uglify-js-es6

uglify-js-es6

JSON →
library2.8.9jsnpmunverified

UglifyJS is a JavaScript parser, minifier, compressor, and beautifier toolkit. This package (uglify-js-es6) is a temporary release of the harmony branch that adds support for ECMAScript 2015+ (ES6+) syntax. The current stable version is 2.8.9, released as a snapshot from the harmony development branch. Unlike the main uglify-js package which only supports ES5, this fork provides ES6+ minification without requiring additional transpilation steps. The package is unmaintained and meant as a stopgap for environments where git is not available—users should instead install directly from the harmony branch on GitHub.

npm install uglify-js-es6
INSTALL
IMPORT
SIG · UGLIFY-JS-ES6
U
uglify-js-es6
devopsjavascriptv2.8.9
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

uglify-js-es6
npm install uglify-js-es6
npm install uglify-js
Use uglify-js-es6 for ES6 support; uglify-js only supports ES5.
minify
import { minify } from 'uglify-js-es6';
const { minify } = require('uglify-js');
Both ESM and CJS are supported; ensure using the correct package.
UglifyJS
const UglifyJS = require('uglify-js-es6');
const UglifyJS = require('uglify-js');
CJS require; package provides UglifyJS object with minify, parse, etc.

Demonstrates basic programmatic minification of ES6 code using uglify-js-es6.

// Install: npm install uglify-js-es6 const UglifyJS = require('uglify-js-es6'); const code = 'function add(a, b) { return a + b; }'; const result = UglifyJS.minify(code, { fromString: true }); if (result.error) { console.error(result.error); } else { console.log(result.code); }
Debug
Known issues
deprecatedThis package is a temporary snapshot of the harmony branch. Use the official harmony branch directly from GitHub.
fix
Use 'npm install mishoo/UglifyJS2#harmony' instead.
affects: all
breakingThe harmony branch may contain unstable APIs that differ from the main uglify-js releases.
fix
Check the harmony branch documentation for API changes.
affects: all
gotchaUnminified ES6+ code may not be fully supported; some syntax features may require specific flags like --harmony.
fix
Use with --harmony option or try alternative tools like terser.
affects: 2.8.9
Errors
Common errors & fixes
Error: Cannot find module 'uglify-js-es6'
Package not installed or typo in package name.
fix
Run 'npm install uglify-js-es6' and ensure correct spelling.
UglifyJS.minify is not a function
Incorrect import or using uglify-js instead of uglify-js-es6.
fix
Use 'const UglifyJS = require("uglify-js-es6");'
Parse error at line... Unexpected token: name (let)
Using main uglify-js which does not support ES6 syntax.
fix
Install uglify-js-es6 or use Terser.
Upgrade
Version history
2.8.9latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
uglify-js-es6 — npm install uglify-js-es6 · libregistry