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.
npm install uglifyjs-3-webpack-pluginVerified import paths — ran on the pinned version, not inferred.
Configures the UglifyJS webpack plugin to minify output, drop console.log statements, remove comments, enable source maps, and run in parallel.
Replace with terser-webpack-plugin: npm i -D terser-webpack-plugin and import TerserPlugin from 'terser-webpack-plugin'.
Use terser-webpack-plugin for webpack 5 projects.
Avoid 'cheap-source-map', 'cheap-module-source-map', etc. Use 'source-map' or 'eval-source-map' instead.
Use const UglifyJsPlugin = require('uglifyjs-3-webpack-plugin'); not const { UglifyJsPlugin } = require(...).Ensure Babel (or similar) transpiles ES6+ to ES5 before this plugin runs; set webpack module rules accordingly.
Run 'npm install uglifyjs-3-webpack-plugin --save-dev' to install.
Use 'const UglifyJsPlugin = require("uglifyjs-3-webpack-plugin");' without curly braces.This plugin is used as 'new UglifyJsPlugin(...)' from package, not from webpack.optimize.
Review uglifyOptions structure; for compress use object like { compress: { drop_console: true } }.