Registry / devops / uglifyjs-classic

uglifyjs-classic

JSON →
library2018.8.15jsnpmunverified

uglifyjs-lite is a zero-dependency JavaScript minifier that provides a browser-compatible version of UglifyJS v1.3.5. Version 2018.8.15 targets Node.js >=4.0 and includes a live web demo. It differs from modern UglifyJS (e.g., terser) by sticking to the older UglifyJS API and supporting both CommonJS and browser usage. The package is unmaintained and likely deprecated in favor of terser or newer UglifyJS versions.

npm install uglifyjs-classic
INSTALL
IMPORT
SIG · UGLIFYJS-CLASSIC
U
uglifyjs-classic
devopsjavascriptv2018.8.15
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.

uglifyjs
✓ var uglifyjs = require('uglifyjs-lite');
✗ import uglifyjs from 'uglifyjs-lite';
This package is not ESM; use require for Node.js or include the script in a browser.

Demonstrates basic minification using the old UglifyJS API.

var uglifyjs = require('uglifyjs-lite'); var minified = uglifyjs.minify('var x = 5;'); console.log(minified); // 'var x=5;'
Debug
Known issues
deprecatedPackage is unmaintained and uses an ancient UglifyJS version. Modern projects should use terser or uglify-js.
fix
Migrate to terser (npm install terser) and use import { minify } from 'terser';
affects: all
gotchaThe API differs from current UglifyJS/terser. The minify function returns a string, not an object with code.
fix
Use the correct API: var output = uglifyjs.minify(input); // returns string
affects: all
gotchaPackage has no TypeScript definitions. Using in TypeScript requires manual type declarations or @ts-ignore.
fix
Declare module in a .d.ts file: declare module 'uglifyjs-lite';
affects: all
breakingPackage versioning is irregular; version 2018.8.15 is the latest. No semantic versioning used.
fix
Pin exact version in package.json: "uglifyjs-lite": "2018.8.15"
affects: all
Errors
Common errors & fixes
Cannot find module 'uglifyjs-lite'
Package not installed or incorrect import path in ESM environment.
fix
Install with npm install uglifyjs-lite, and use require instead of import.
uglifyjs.minify is not a function
Importing the package incorrectly (e.g., as default import).
fix
Use const uglifyjs = require('uglifyjs-lite'); then uglifyjs.minify(...).
uglifyjs_lite is not defined
In browser, script include may not expose global.
fix
Use <script src="node_modules/uglifyjs-lite/index.js"></script> and access uglifyjs global.
Upgrade
Version history
2018.8.15latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
uglifyjs-classic — npm install uglifyjs-classic · libregistry