Default parameter values cause Uglify to crash
Closed this issue · 1 comments
I added a default parameter to my JS function and Uglify suddenly started crashing.
This caused a crash:
function gmAlert(message, title = "Warning") {}
This didn't cause a crash:
function gmAlert(message, title) {}
The crash looked like this:
events.js:163
throw er; // Unhandled 'error' event
^
GulpUglifyError: unable to minify JavaScript
at createError (/Users/murray/dev/sobs-git/trunk/node_modules/gulp-uglify/lib/create-error.js:6:14)
at apply (/Users/murray/dev/sobs-git/trunk/node_modules/gulp-uglify/node_modules/lodash/_apply.js:16:25)
at wrapper (/Users/murray/dev/sobs-git/trunk/node_modules/gulp-uglify/node_modules/lodash/_createCurry.js:41:12)
at /Users/murray/dev/sobs-git/trunk/node_modules/gulp-uglify/lib/minify.js:54:15
at DestroyableTransform._transform (/Users/murray/dev/sobs-git/trunk/node_modules/gulp-uglify/composer.js:10:23)
at DestroyableTransform.Transform._read (/Users/murray/dev/sobs-git/trunk/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:159:10)
at DestroyableTransform.Transform._write (/Users/murray/dev/sobs-git/trunk/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:147:83)
at doWrite (/Users/murray/dev/sobs-git/trunk/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:338:64)
at writeOrBuffer (/Users/murray/dev/sobs-git/trunk/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:327:5)
at DestroyableTransform.Writable.write (/Users/murray/dev/sobs-git/trunk/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:264:11)
rata:trunk murray$ gulp --version
[14:20:51] CLI version 3.9.1
[14:20:51] Local version 3.9.1
You need to use a version of UglifyJS that supports harmony features. There's an example in the README