The console cleaner conflicts with some libraries
KATT opened this issue · comments
I had momentjs in my project and realised that groundskeeper just clears file except for the top comment.
I reduced the file to a small function to reproduce the error and the problem seems to occur because the author has put some console.*
in an if-statement as this:
if (moment.suppressDeprecationWarnings === false &&
typeof console !== 'undefined' && console.warn) {
console.warn("Deprecation warning: " + msg);
}
Which cascades into the whole file getting cleared.
I made a branch with the failing test. See the console.if-statement.js
here and what it actually ends up doing with the file.
I might be able to fix it, but going on holiday tomorrow so it'll take a few weeks before I get back on it.
Sadly, for now, my project will have some dirt in it's production code.
I ended up using UglifyJS' drop_console
flag & will probably end up using UglifyJS as a preprocessor too rather than groundskeeper pragmas. Didn't know that UglifyJS could do all of that.
I was going to suggest just that, I'm glad you could find an alternative.
When I started groundskeeper, UglifyJS couldn't that, however with time and development, it became a really awesome tool and step by step is making groundskeeper totally useless, which is cool :)
I'll take a look at your bug later after I get out of work since it's quite a serious bug.
I still use groundskeeper pragmas since I find them to a lot simpler and pretty, but I reckon that's quite subjective :)