guagay_wk
guagay_wk

Reputation: 28050

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$

Upvotes: 1

Views: 1251

Answers (2)

guagay_wk
guagay_wk

Reputation: 28050

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.

There is another method without suppressing the warning_level to QUIET.

  • Go to Settings->Tools->File Watchers->Edit Watcher ...
  • Uncheck the box "Create output file from stdout"

Upvotes: 3

Jan
Jan

Reputation: 59

Hard to tell without seeing the code itself. Did you try closure options like discussed here:

Upvotes: 1

Related Questions