{"id":20636,"library":"uglifyjs-3-webpack-plugin","title":"uglifyjs-3-webpack-plugin","description":"Webpack plugin that uses UglifyJS v3 to minify JavaScript. Version 1.2.4 was last released in 2018 and is compatible with webpack 2, 3, and 4. It wraps UglifyJS 3 (ES6+ support) and offers caching, parallelization, source maps, and comment extraction. Unlike the official uglifyjs-webpack-plugin (which may use v2 or v3 depending on version), this plugin specifically targets UglifyJS v3 and is a lightweight alternative.","status":"deprecated","version":"1.2.4","language":"javascript","source_language":"en","source_url":"https://github.com/whtsky/uglifyjs-3-webpack-plugin","tags":["javascript","uglify","uglify-js","webpack","webpack-plugin"],"install":[{"cmd":"npm install uglifyjs-3-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add uglifyjs-3-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add uglifyjs-3-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"UglifyJS v3 is the core minifier engine; plugin depends on at least version 3.0.0.","package":"uglify-js","optional":false},{"reason":"Peer dependency on webpack ^2.0.0 || ^3.0.0 || ^4.0.0; not suitable for webpack 5.","package":"webpack","optional":false}],"imports":[{"note":"This package does not export ESM; use CommonJS require.","wrong":"import UglifyJsPlugin from 'uglifyjs-3-webpack-plugin';","symbol":"default","correct":"const UglifyJsPlugin = require('uglifyjs-3-webpack-plugin');"},{"note":"Default export, not named export. Destructuring will result in undefined.","wrong":"const { UglifyJsPlugin } = require('uglifyjs-3-webpack-plugin');","symbol":"UglifyJsPlugin","correct":"const UglifyJsPlugin = require('uglifyjs-3-webpack-plugin');"},{"note":"For webpack 4, you should use the optimization.minimizer config, not plugins. However, this plugin's docs show plugins array; for webpack 4, prefer the minizer approach with optimization.minimize: true.","wrong":"optimization: { minimizer: [new UglifyJsPlugin()] }","symbol":"webpack.config.js usage","correct":"plugins: [new UglifyJsPlugin({ sourceMap: true })]"}],"quickstart":{"code":"const UglifyJsPlugin = require('uglifyjs-3-webpack-plugin');\n\nmodule.exports = {\n  entry: './src/index.js',\n  output: { filename: 'bundle.js' },\n  plugins: [\n    new UglifyJsPlugin({\n      uglifyOptions: {\n        compress: { drop_console: true },\n        output: { comments: false }\n      },\n      sourceMap: true,\n      parallel: true\n    })\n  ]\n};","lang":"javascript","description":"Configures the UglifyJS webpack plugin to minify output, drop console.log statements, remove comments, enable source maps, and run in parallel."},"warnings":[{"fix":"Replace with terser-webpack-plugin: npm i -D terser-webpack-plugin and import TerserPlugin from 'terser-webpack-plugin'.","message":"This package is deprecated; use terser-webpack-plugin instead for webpack 4+.","severity":"deprecated","affected_versions":"*"},{"fix":"Use terser-webpack-plugin for webpack 5 projects.","message":"Not compatible with webpack 5; only supports webpack 2, 3, and 4.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Avoid 'cheap-source-map', 'cheap-module-source-map', etc. Use 'source-map' or 'eval-source-map' instead.","message":"cheap-source-map devtool options do not work with this plugin; use other source map strategies.","severity":"gotcha","affected_versions":"*"},{"fix":"Use const UglifyJsPlugin = require('uglifyjs-3-webpack-plugin'); not const { UglifyJsPlugin } = require(...).","message":"Default export; destructuring require will result in undefined.","severity":"gotcha","affected_versions":"*"},{"fix":"Ensure Babel (or similar) transpiles ES6+ to ES5 before this plugin runs; set webpack module rules accordingly.","message":"UglifyJS v3 may fail on ES6+ syntax if not transpiled by Babel prior to minification.","severity":"broken","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install uglifyjs-3-webpack-plugin --save-dev' to install.","cause":"Package not installed or missing from node_modules.","error":"Error: Cannot find module 'uglifyjs-3-webpack-plugin'"},{"fix":"Use 'const UglifyJsPlugin = require(\"uglifyjs-3-webpack-plugin\");' without curly braces.","cause":"Importing the package incorrectly by destructuring the default export.","error":"TypeError: UglifyJsPlugin is not a constructor"},{"fix":"This plugin is used as 'new UglifyJsPlugin(...)' from package, not from webpack.optimize.","cause":"Confusion with webpack built-in plugin (webpack 3 and below) vs this plugin.","error":"Error: webpack.optimize.UglifyJsPlugin is not a constructor"},{"fix":"Review uglifyOptions structure; for compress use object like { compress: { drop_console: true } }.","cause":"Passing unsupported options, e.g., 'compress: {}' without proper format.","error":"ValidationError: Invalid options object. UglifyJs Plugin has been initialized using an options object that does not match the API schema."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}