drop_console does not drop window.console.log() functions

159 views
Skip to first unread message

Dominique Busser

unread,
Nov 12, 2015, 10:59:36 AM11/12/15
to UglifyJS
Steps to reproduce:

  1. Get jQuery Migrate from here https://gist.github.com/doque/7591fcf2ad555d15c7de
  2. run uglifyjs (version 2.4.10): 
    uglifyjs -c drop_console jquery-migrate.js > jquery-migrate.min.js

  3. Minification results in this code: https://gist.github.com/doque/d496f106b498660d8f08 which still contains:
    window.console.log("JQMIGRATE: Logging is active")
What should happen?

  1. All references to window.console.log should be dropped.

Mihai Călin Bazon

unread,
Nov 12, 2015, 11:10:03 AM11/12/15
to ugli...@googlegroups.com
At the moment, it only drops it when it literally sees `console.*`
(unprefixed). Given that there are a multitude of ways to access the
console (i.e. `global.console` in NodeJS, `window.self.console` in
browser, `this.console` in a function where `this` refers to the
global object etc.), I wouldn't complicate the code with one special
case, so I'm calling it a WONTFIX.
> --
> You received this message because you are subscribed to the Google Groups
> "UglifyJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to uglifyjs+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Mihai Bazon,
http://lisperator.net/
Reply all
Reply to author
Forward
0 new messages