Registry / devops / uglifyjs-3-webpack-plugin

uglifyjs-3-webpack-plugin

JSON →
library1.2.4jsnpmunverified

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-plugin
INSTALL
IMPORT
SIG · UGLIFYJS-3-WEBPACK
U
uglifyjs-3-webpack-plugin
devopsjavascriptv1.2.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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

default
const UglifyJsPlugin = require('uglifyjs-3-webpack-plugin');
import UglifyJsPlugin from 'uglifyjs-3-webpack-plugin';
This package does not export ESM; use CommonJS require.
UglifyJsPlugin
const UglifyJsPlugin = require('uglifyjs-3-webpack-plugin');
const { UglifyJsPlugin } = require('uglifyjs-3-webpack-plugin');
Default export, not named export. Destructuring will result in undefined.
webpack.config.js usage
plugins: [new UglifyJsPlugin({ sourceMap: true })]
optimization: { minimizer: [new UglifyJsPlugin()] }
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.

Configures the UglifyJS webpack plugin to minify output, drop console.log statements, remove comments, enable source maps, and run in parallel.

const UglifyJsPlugin = require('uglifyjs-3-webpack-plugin'); module.exports = { entry: './src/index.js', output: { filename: 'bundle.js' }, plugins: [ new UglifyJsPlugin({ uglifyOptions: { compress: { drop_console: true }, output: { comments: false } }, sourceMap: true, parallel: true }) ] };
Debug
Known issues
deprecatedThis package is deprecated; use terser-webpack-plugin instead for webpack 4+.
fix
Replace with terser-webpack-plugin: npm i -D terser-webpack-plugin and import TerserPlugin from 'terser-webpack-plugin'.
affects: *
breakingNot compatible with webpack 5; only supports webpack 2, 3, and 4.
fix
Use terser-webpack-plugin for webpack 5 projects.
affects: >=1.0.0
gotchacheap-source-map devtool options do not work with this plugin; use other source map strategies.
fix
Avoid 'cheap-source-map', 'cheap-module-source-map', etc. Use 'source-map' or 'eval-source-map' instead.
affects: *
gotchaDefault export; destructuring require will result in undefined.
fix
Use const UglifyJsPlugin = require('uglifyjs-3-webpack-plugin'); not const { UglifyJsPlugin } = require(...).
affects: *
brokenUglifyJS v3 may fail on ES6+ syntax if not transpiled by Babel prior to minification.
fix
Ensure Babel (or similar) transpiles ES6+ to ES5 before this plugin runs; set webpack module rules accordingly.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'uglifyjs-3-webpack-plugin'
Package not installed or missing from node_modules.
fix
Run 'npm install uglifyjs-3-webpack-plugin --save-dev' to install.
TypeError: UglifyJsPlugin is not a constructor
Importing the package incorrectly by destructuring the default export.
fix
Use 'const UglifyJsPlugin = require("uglifyjs-3-webpack-plugin");' without curly braces.
Error: webpack.optimize.UglifyJsPlugin is not a constructor
Confusion with webpack built-in plugin (webpack 3 and below) vs this plugin.
fix
This plugin is used as 'new UglifyJsPlugin(...)' from package, not from webpack.optimize.
ValidationError: Invalid options object. UglifyJs Plugin has been initialized using an options object that does not match the API schema.
Passing unsupported options, e.g., 'compress: {}' without proper format.
fix
Review uglifyOptions structure; for compress use object like { compress: { drop_console: true } }.
Upgrade
Version history
1.2.4latest on npm
Audit
Dependencies
uglify-jsrequiredUglifyJS v3 is the core minifier engine; plugin depends on at least version 3.0.0.
webpackrequiredPeer dependency on webpack ^2.0.0 || ^3.0.0 || ^4.0.0; not suitable for webpack 5.
Agent activity
6 hits · last 30 days
node
6
Resources
uglifyjs-3-webpack-plugin — npm install uglifyjs-3-webpack-plugin · libregistry