UglifyJS icon indicating copy to clipboard operation
UglifyJS copied to clipboard

Use --in-source-map when generating warnings

Open dantman opened this issue 9 years ago • 1 comments

It would be useful if UglifyJS' warnings took the input source-map into account, even if it's an optional feature.

In my workflow I browserify stuff and then save it to a temp file to run uglifyjs, so personally my warnings look something like this:

WARN: Dropping unused function argument name [/var/folders/t4/lr96d_b55fd7f5cb1c_60rl80000gn/T/otakucore-source90446dpphde8.js:56,28]
WARN: Dropping unused function argument dir [/var/folders/t4/lr96d_b55fd7f5cb1c_60rl80000gn/T/otakucore-source90446dpphde8.js:62,26]
WARN: Dropping unused function argument exports [/var/folders/t4/lr96d_b55fd7f5cb1c_60rl80000gn/T/otakucore-source90446dpphde8.js:1,437]
WARN: Dropping unused function argument deleteCount [/var/folders/t4/lr96d_b55fd7f5cb1c_60rl80000gn/T/otakucore-source90446dpphde8.js:421,35]
WARN: Dropping unused function argument start [/var/folders/t4/lr96d_b55fd7f5cb1c_60rl80000gn/T/otakucore-source90446dpphde8.js:421,28]
WARN: Dropping unused function argument key [/var/folders/t4/lr96d_b55fd7f5cb1c_60rl80000gn/T/otakucore-source90446dpphde8.js:946,44]
WARN: Side effects in initialization of unused variable array_push [/var/folders/t4/lr96d_b55fd7f5cb1c_60rl80000gn/T/otakucore-source90446dpphde8.js:113,4]
WARN: Dropping unused function argument exports [/var/folders/t4/lr96d_b55fd7f5cb1c_60rl80000gn/T/otakucore-source90446dpphde8.js:1499,33]
WARN: Dropping unused function argument properties [/var/folders/t4/lr96d_b55fd7f5cb1c_60rl80000gn/T/otakucore-source90446dpphde8.js:12433,35]
WARN: Dropping unused variable isCurryBound [/var/folders/t4/lr96d_b55fd7f5cb1c_60rl80000gn/T/otakucore-source90446dpphde8.js:12996,10]
WARN: Dropping unused function argument exports [/var/folders/t4/lr96d_b55fd7f5cb1c_60rl80000gn/T/otakucore-source90446dpphde8.js:18386,33]
WARN: Dropping unused function argument exports [/var/folders/t4/lr96d_b55fd7f5cb1c_60rl80000gn/T/otakucore-source90446dpphde8.js:20437,43]
WARN: Dropping unused function argument exports [/var/folders/t4/lr96d_b55fd7f5cb1c_60rl80000gn/T/otakucore-source90446dpphde8.js:29964,33]
WARN: Dropping unused function argument exports [/var/folders/t4/lr96d_b55fd7f5cb1c_60rl80000gn/T/otakucore-source90446dpphde8.js:29971,58]
WARN: Dropping unused function argument exports [/var/folders/t4/lr96d_b55fd7f5cb1c_60rl80000gn/T/otakucore-source90446dpphde8.js:29982,75]
WARN: Dropping unused function argument exports [/var/folders/t4/lr96d_b55fd7f5cb1c_60rl80000gn/T/otakucore-source90446dpphde8.js:29984,34]
WARN: Dropping unused function argument module [/var/folders/t4/lr96d_b55fd7f5cb1c_60rl80000gn/T/otakucore-source90446dpphde8.js:29984,27]

I give uglifyjs an --in-source-map filled with information on where all the JS I'm minifying, using it to try and resolve the original location would likely lead to much more readable warnings.

Though even without a situation as rare as mine this feature would probably be useful to others since there should be plenty others using things like browserify or coffee-script that compile before uglifying and generate sourcemap.

dantman avatar Jul 15 '14 10:07 dantman