{"id":22268,"library":"rollup-plugin-uglify","title":"rollup-plugin-uglify","description":"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).","status":"active","version":"6.0.4","language":"javascript","source_language":"en","source_url":"https://github.com/TrySound/rollup-plugin-uglify","tags":["javascript","rollup","rollup-plugin","uglify","minify"],"install":[{"cmd":"npm install rollup-plugin-uglify","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-uglify","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-uglify","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; plugin requires rollup to function","package":"rollup","optional":false}],"imports":[{"note":"Default export changed to named export in v4.0.0. ESM-only, no CommonJS named export.","wrong":"const uglify = require('rollup-plugin-uglify')","symbol":"uglify","correct":"import { uglify } from 'rollup-plugin-uglify'"},{"note":"Default export removed in v4.0.0. Must use named import.","wrong":"import uglify from 'rollup-plugin-uglify'","symbol":"uglify","correct":"import { uglify } from 'rollup-plugin-uglify'"},{"note":"For CommonJS usage, destructure the named export. Direct require gives an object with uglify property.","wrong":"const uglify = require('rollup-plugin-uglify')","symbol":"uglify","correct":"const { uglify } = require('rollup-plugin-uglify')"}],"quickstart":{"code":"// Install: npm install --save-dev rollup-plugin-uglify\n// rollup.config.js\nimport { uglify } from 'rollup-plugin-uglify';\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'iife'\n  },\n  plugins: [\n    uglify({\n      sourcemap: true,\n      numWorkers: 2,\n      output: {\n        comments: 'some'\n      }\n    })\n  ]\n};","lang":"javascript","description":"Basic Rollup configuration using rollup-plugin-uglify to minify output with source maps and custom comments."},"warnings":[{"fix":"import { uglify } from 'rollup-plugin-uglify'","message":"Default export removed in v4.0.0. Use named import { uglify } instead.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Switch to rollup-plugin-terser if you need ES6+ minification.","message":"Removed 'minifier' option in v5.0.0. Use rollup-plugin-terser for UglifyES/Terser.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Use { sourcemap: true } instead of { sourceMap: true }","message":"Renamed 'sourceMap' option to 'sourcemap' in v5.0.0 to match Rollup API.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Replace with rollup-plugin-terser if your code contains ES6+ syntax.","message":"rollup-plugin-uglify only supports ES5. For ES6+ code, use rollup-plugin-terser.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Check rollup version; consider using rollup-plugin-terser for Rollup >=2.","message":"Package requires Rollup >=0.66.0 and <2. It may not work with Rollup v2 or later.","severity":"gotcha","affected_versions":">=0.66.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use named import: import { uglify } from 'rollup-plugin-uglify'","cause":"Using default import or CommonJS require incorrectly in v4+.","error":"Error: 'uglify' is not exported from 'rollup-plugin-uglify'"},{"fix":"Ensure uglify() is called with an object: uglify({ numWorkers: 2 })","cause":"Missing options object or passing invalid workers configuration.","error":"TypeError: Cannot set property 'numWorkers' of undefined"},{"fix":"Use rollup-plugin-terser instead, or transpile code to ES5 first.","cause":"UglifyJS cannot parse ES6+ syntax; this plugin only handles ES5.","error":"SyntaxError: Unexpected token: punc ())"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}