webpack 3 is missing uglify v2.x dependency which breaks the build

Do you want to request a feature or report a bug?
bug

What is the current behavior?
I’m getting the following error:

ERROR in bundle-main.js from UglifyJs
TypeError: Cannot read property 'reset' of undefined
    at /Users/user/project/node_modules/uglifyjs-webpack-plugin/dist/index.js:96:21
    at Array.forEach (native)
    at Compilation.<anonymous> (/Users/user/project/node_modules/uglifyjs-webpack-plugin/dist/index.js:54:20)
    at Compilation.applyPluginsAsyncSeries (/Users/user/project/node_modules/tapable/lib/Tapable.js:142:13)
    at self.applyPluginsAsync.err (/Users/user/project/node_modules/webpack/lib/Compilation.js:641:10)
    at next (/Users/user/project/node_modules/tapable/lib/Tapable.js:138:11)
    at ExtractTextPlugin.<anonymous> (/Users/user/project/node_modules/extract-text-webpack-plugin/index.js:345:4)
    at Compilation.applyPluginsAsyncSeries (/Users/user/project/node_modules/tapable/lib/Tapable.js:142:13)
    at sealPart2 (/Users/user/project/node_modules/webpack/lib/Compilation.js:637:9)
    at next (/Users/user/project/node_modules/tapable/lib/Tapable.js:138:11)
    at ExtractTextPlugin.<anonymous> (/Users/user/project/node_modules/extract-text-webpack-plugin/index.js:317:5)
    at /Users/user/project/node_modules/async/dist/async.js:421:16
    at iteratorCallback (/Users/user/project/node_modules/async/dist/async.js:998:13)
    at /Users/user/project/node_modules/async/dist/async.js:906:16
    at /Users/user/project/node_modules/extract-text-webpack-plugin/index.js:301:6
    at /Users/user/project/node_modules/async/dist/async.js:421:16
    at iteratorCallback (/Users/user/project/node_modules/async/dist/async.js:998:13)
    at /Users/user/project/node_modules/async/dist/async.js:906:16
    at /Users/user/project/node_modules/extract-text-webpack-plugin/index.js:298:13
    at /Users/user/project/node_modules/async/dist/async.js:3060:16
    at eachOfArrayLike (/Users/user/project/node_modules/async/dist/async.js:1003:9)
    at eachOf (/Users/user/project/node_modules/async/dist/async.js:1051:5)
    at Object.eachLimit (/Users/user/project/node_modules/async/dist/async.js:3122:5)

I’m pretty sure this is because webpack 2.6 had "uglify-js": "^2.8.27" as a dependency, but webpack 3.0 has only "uglifyjs-webpack-plugin": "^0.4.4" as a dependency (which does NOT pull in uglify-js v2!)

If the current behavior is a bug, please provide the steps to reproduce.

It seems to be occurring whenever I use the -p option from the CLI.

What is the expected behavior?
Errors should not occur when using minification via uglify js.

If this is a feature request, what is motivation or use case for changing the behavior?

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.
Webpack 3.0
Node 8.1.2
MacOS 10.12.5

Author: Fantashit

2 thoughts on “webpack 3 is missing uglify v2.x dependency which breaks the build

Comments are closed.