In WebStorm, my project is a library made up of 10 js files and Closure Compiler, as file watcher in WebStorm, compiles the files in a single one.
Arguments for Closure Compiler file watcher are ... --js 1.js --js 2.js ... --js 10.js --js_output_file mylib.min.js ...
When I modify one of these files and save it, I can see immediately in WebStorm "background tasks", 1 new item "Executing 'Closure Compiler' task..." and this is fine.
The problem: when I modify many files and do a "Save", many "Executing 'Closure Compiler' task..." appear in "background tasks" (ex: 5 tasks if 5 files modified). All tasks are doing the same 10 file compilation although 1 task only is required. My computer is out of control (100% CPU) for a while and I have to cancel all the tasks except one to get it completed faster.
WebStorm launches a watcher task for each modified file and doesn't understand that launching many identical tasks at the same time is pointless.
Is there a way to get a single watcher task although many file modified ? If not, is there at least a way to avoid a "100% CPU" issue (ex: decrease the WebStorm process priority) ?
Got the solution from Alexander Doroshko at JetBrain:
Remove any file-specific macros (those that start with $File ) in the File Watcher settings (specifically 'Arguments' and 'Working directory' field).
$FileDir
is by default in the 'Working directory' field, I removed it and hardcoded the path instead.
I have indeed now a single task although many files changed.