Closed guybedford closed 9 years ago
@guybedford Ah, aliasing console
does seem like the right thing. Since unhandled rejections are in the same class of things as uncaught exceptions, I think people will be surprised (as you were!) if uglify silences them.
I can push a branch for you to try out in a few mins.
Just pushed the prevent-console-removal branch. Can you try it out to make sure I got it right? If all is good, there's one other spot I need to update, and then I'll get this merged in and ready for a patch release. Thanks!
@briancavalier thanks so much for the quick response. Yes I can confirm that is working great.
Great, thanks for confirming. I should be able to get a release out today.
@guybedford version 3.5.2 landed with this fix.
Amazing, thanks for the speedy release.
I finally worked out the reason unhandledRejection errors still aren't showing for me.
I'm running the
drop_console
uglifyjs option to remove debug statements in the final file, and it is also removing theconsole.*
statements from when.js in the process.It's a big of an ask I know, as I should really just rewrite my build process, but perhaps it would be useful to other users to consider adjusting these statements to be non-droppable.
In https://github.com/cujojs/when/blob/master/lib/decorators/unhandledRejection.js, simply assigning console to a local variable first is enough to make this work and I've tested this successfully (
var c = console
).