terinjokes / gulp-uglify

Minify files with UglifyJS
MIT License
1.23k stars 155 forks source link

Unkown property in compress, throws error: "Missing error message" #65

Closed kirkov closed 9 years ago

kirkov commented 9 years ago

If I have drop_console: true in compress, I get this error: "Missing error message". I guess it's because drop_console is no longer supported? I could not find it in the Uglify docs.

If I remove it, it works fine. But maybe there should be a better error message?

Options:

var uglifyOptions =
{
    mangle: false,
    compress:
    {
        drop_console: true,
        global_defs:
        {
            DEBUG: false
        }
    }
};

Error output:

c:\Work\node_modules\gulp-uglify\node_modules\gulp-util\lib\PluginError.js:72
  if (!this.message) throw new Error('Missing error message');
                           ^
Error: Missing error message
    at new PluginError (c:\Work\node_modules\gulp-uglify\node_modules\gulp-util\lib\PluginError.js:72:28)
    at DestroyableTransform.minify [as _transform] (c:\Work\node_modules\gulp-uglify\index.js:55:20)
    at DestroyableTransform.Transform._read (c:\Work\node_modules\gulp-uglify\node_modules\through2\node_modules\readable-stream\lib\_s
tream_transform.js:184:10)
    at DestroyableTransform.Transform._write (c:\Work\node_modules\gulp-uglify\node_modules\through2\node_modules\readable-stream\lib\_
stream_transform.js:172:12)
    at doWrite (c:\Work\node_modules\gulp-uglify\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:237:10)
    at writeOrBuffer (c:\Work\node_modules\gulp-uglify\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:227:5
)
    at DestroyableTransform.Writable.write (c:\Work\node_modules\gulp-uglify\node_modules\through2\node_modules\readable-stream\lib\_st
ream_writable.js:194:11)
    at write (_stream_readable.js:601:24)
    at flow (_stream_readable.js:610:7)
    at _stream_readable.js:578:7
terinjokes commented 9 years ago

@kirkov "drop_console" is supported by UglifyJS, and is listed right on that project's README.

Do you still have the error if the only difference is that you've removed "drop_console" from the configuration?

Also, can you provide the output of npm ls.

yairEO commented 9 years ago

I also have this error for this:

.pipe(uglify({compress:{ sequences:true, conditionals:true, booleans:true, unused:true, if_return:true, join_vars:true, drop_console:true }, mangle:true}))

Output:

C:\xampp\htdocs\gurushots\html\trunk\website\node_modules\gulp-uglify\node_modules\gulp-util\lib\PluginError.js:72
  if (!this.message) throw new Error('Missing error message');
                           ^
Error: Missing error message
    at new PluginError (C:\xampp\htdocs\gurushots\html\trunk\website\node_modules\gulp-uglify\node_modules\gulp-util\lib
\PluginError.js:72:28)
    at DestroyableTransform.minify [as _transform] (C:\xampp\htdocs\gurushots\html\trunk\website\node_modules\gulp-uglif
y\index.js:55:20)
    at DestroyableTransform.Transform._read (C:\xampp\htdocs\gurushots\html\trunk\website\node_modules\gulp-uglify\node_
modules\through2\node_modules\readable-stream\lib\_stream_transform.js:184:10)
    at DestroyableTransform.Transform._write (C:\xampp\htdocs\gurushots\html\trunk\website\node_modules\gulp-uglify\node
_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:172:12)
    at doWrite (C:\xampp\htdocs\gurushots\html\trunk\website\node_modules\gulp-uglify\node_modules\through2\node_modules
\readable-stream\lib\_stream_writable.js:237:10)
    at writeOrBuffer (C:\xampp\htdocs\gurushots\html\trunk\website\node_modules\gulp-uglify\node_modules\through2\node_m
odules\readable-stream\lib\_stream_writable.js:227:5)
    at DestroyableTransform.Writable.write (C:\xampp\htdocs\gurushots\html\trunk\website\node_modules\gulp-uglify\node_m
odules\through2\node_modules\readable-stream\lib\_stream_writable.js:194:11)
    at write (C:\xampp\htdocs\gurushots\html\trunk\website\node_modules\gulp\node_modules\vinyl-fs\node_modules\through2
\node_modules\readable-stream\lib\_stream_readable.js:623:24)
    at flow (C:\xampp\htdocs\gurushots\html\trunk\website\node_modules\gulp\node_modules\vinyl-fs\node_modules\through2\
node_modules\readable-stream\lib\_stream_readable.js:632:7)
    at DestroyableTransform.pipeOnReadable (C:\xampp\htdocs\gurushots\html\trunk\website\node_modules\gulp\node_modules\
vinyl-fs\node_modules\through2\node_modules\readable-stream\lib\_stream_readable.js:664:5)

C:\xampp\htdocs\gurushots\html\trunk\website>

My npm ls output is way too long to copy, and doesn't get printed as a whole..is cut in the top part. should I look for something in particular? Everything was working fine till recently.

schnittstabil commented 9 years ago

IMHO this is fixed by 4cd6ae08ffadc70de536a0919dc7659d4fc26009, which drops:

PluginError(pluginName, e.message || e.msg, ...)

@kirkov and @yairEO: The expression moved from index.js line 55 to line 17 (respectively 18) with 14f50891494b09f5df97825fa74b3dabad4aeade

Since then there has been no PluginError expression anymore which might throw such an error. (See git grep "new PluginError" $(git rev-list --all))