Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use --in-source-map when generating warnings #516

Open
dantman opened this issue Jul 15, 2014 · 1 comment
Open

Use --in-source-map when generating warnings #516

dantman opened this issue Jul 15, 2014 · 1 comment

Comments

@dantman
Copy link

dantman commented Jul 15, 2014

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.

@pfeigl
Copy link

pfeigl commented May 20, 2018

This isn't as rare as you might think. ng-packagr is using a similar process and as ng-packagr is now used internally to generate new libraries using @angular/cli, this is probably coming up for quite alot people.

pfeigl added a commit to pfeigl/ng-packagr that referenced this issue May 20, 2018
This should help the normal user to identify the bundled source file which originated the warnings.
There is also mishoo/UglifyJS#516 which tracks using the source-maps to
display the correct originating file of the warning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants