UglifyJS Webpack Plugin uses UglifyJS (v2) to minify JavaScript bundles generated by webpack. The latest stable version is 2.2.0, released July 2019, supporting webpack 4+ and Node 6.9+. It offers caching, parallelization, source maps, and advanced options like chunk filtering. However, it is now largely superseded by terser-webpack-plugin, which supports ES6+ and is the recommended minimizer for webpack 4+. This plugin switched back from uglify-es to uglify-js in v2.0.0, meaning it does not handle modern JavaScript (ES6+) out of the box. It is in maintenance mode with no active development.
npm install uglifyjs-webpack-pluginVerified import paths — ran on the pinned version, not inferred.
Configures webpack to use UglifyJS plugin with caching, parallelization, source maps, and options to remove console logs and comments.
For ES6+ support, migrate to terser-webpack-plugin.
Use terser-webpack-plugin for active development and ES6+ minification.
Set parallel: false in plugin options.
Set cache to a custom path or disable cache in CI.
Use optimization: { minimizer: [new UglifyJsPlugin()] } in webpack config.Explicitly set extractComments option to control comment extraction.
Move the plugin instance to optimization: { minimizer: [new UglifyJsPlugin()] }.Use: const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); new UglifyJsPlugin();Ensure uglify-js version 2.x is installed (npm install uglify-js@2).
Set parallel: false or ensure worker-farm is properly installed.