user91579631 user91579631 - 1 month ago 15
Node.js Question

Remove warning on minified js by Google closure compiler

I get warning after minifying js file with Google closure compiler. The warning appears at the top of the minified file and looks something like this;

test_chk.js:198: WARNING - unreachable code
return;
^


Do I have to manually remove this warning from the minified file? How can I get closure compiler not to put these warnings on the minified file? Some of the warnings are for code that are legitimate that I want to leave there.

I am using node.js v4.6 on WebStorm 2016.2.3

EDIT: The closure compiler was run in this manner with the following arguments on Webstorm;

closure-compiler-v20160911.jar --compilation_level SIMPLE_OPTIMIZATIONS --js $FileName$

Answer

Use the following arguments on Webstorm for the Google closure compiler;

closure-compiler-v20160911.jar --warning_level QUIET --compilation_level SIMPLE_OPTIMIZATIONS --js $FileName$

The key lies in suppressing the warning_level to QUIET.