Registry / devops / rollup-plugin-uglify

rollup-plugin-uglify

JSON →
library6.0.4jsnpmunverified

Rollup plugin to minify generated bundles using UglifyJS. Current stable version is 6.0.4, compatible with Rollup >=0.66.0 <2. It runs UglifyJS in a worker per chunk, improving build performance for code-split projects, and displays errors with babel code frames. Supports source maps and configurable number of workers. Note: UglifyJS handles only ES5; for ES6+ use the similar rollup-plugin-terser. This plugin has undergone several breaking changes in major versions, including moving to worker-based uglification (v5) and reverting from uglify-es back to uglify-js (v4).

npm install rollup-plugin-uglify
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-UGLI
R
rollup-plugin-uglify
devopsjavascriptv6.0.4
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

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

uglify
import { uglify } from 'rollup-plugin-uglify'
const uglify = require('rollup-plugin-uglify')
Default export changed to named export in v4.0.0. ESM-only, no CommonJS named export.
uglify
import { uglify } from 'rollup-plugin-uglify'
import uglify from 'rollup-plugin-uglify'
Default export removed in v4.0.0. Must use named import.
uglify
const { uglify } = require('rollup-plugin-uglify')
const uglify = require('rollup-plugin-uglify')
For CommonJS usage, destructure the named export. Direct require gives an object with uglify property.

Basic Rollup configuration using rollup-plugin-uglify to minify output with source maps and custom comments.

// Install: npm install --save-dev rollup-plugin-uglify // rollup.config.js import { uglify } from 'rollup-plugin-uglify'; export default { input: 'src/index.js', output: { file: 'dist/bundle.js', format: 'iife' }, plugins: [ uglify({ sourcemap: true, numWorkers: 2, output: { comments: 'some' } }) ] };
Debug
Known issues
breakingDefault export removed in v4.0.0. Use named import { uglify } instead.
fix
import { uglify } from 'rollup-plugin-uglify'
affects: >=4.0.0
breakingRemoved 'minifier' option in v5.0.0. Use rollup-plugin-terser for UglifyES/Terser.
fix
Switch to rollup-plugin-terser if you need ES6+ minification.
affects: >=5.0.0
breakingRenamed 'sourceMap' option to 'sourcemap' in v5.0.0 to match Rollup API.
fix
Use { sourcemap: true } instead of { sourceMap: true }
affects: >=5.0.0
deprecatedrollup-plugin-uglify only supports ES5. For ES6+ code, use rollup-plugin-terser.
fix
Replace with rollup-plugin-terser if your code contains ES6+ syntax.
affects: >=4.0.0
gotchaPackage requires Rollup >=0.66.0 and <2. It may not work with Rollup v2 or later.
fix
Check rollup version; consider using rollup-plugin-terser for Rollup >=2.
affects: >=0.66.0
Errors
Common errors & fixes
Error: 'uglify' is not exported from 'rollup-plugin-uglify'
Using default import or CommonJS require incorrectly in v4+.
fix
Use named import: import { uglify } from 'rollup-plugin-uglify'
TypeError: Cannot set property 'numWorkers' of undefined
Missing options object or passing invalid workers configuration.
fix
Ensure uglify() is called with an object: uglify({ numWorkers: 2 })
SyntaxError: Unexpected token: punc ())
UglifyJS cannot parse ES6+ syntax; this plugin only handles ES5.
fix
Use rollup-plugin-terser instead, or transpile code to ES5 first.
Upgrade
Version history
6.0.4latest on npm
Audit
Dependencies
rolluprequiredpeer dependency; plugin requires rollup to function
Agent activity
2 hits · last 30 days
node
2
Resources
rollup-plugin-uglify — npm install rollup-plugin-uglify · libregistry