How can I debug a minified JS in firebug?

Kumar picture Kumar · Mar 22, 2011 · Viewed 41.9k times · Source


I have a web page which includes insane amount of minified JS files. The web page works perfectly fine on my local network but throws some JS error on staging. There is an issue in JS and I wan't to debug it. When I load the JS in Firebug's script tag it appears in one long horizontal line. Is there a way out in Firebug that expands or beautifies the script for debugging? I know I can use jsbeautifier but they wont help me. I can not upload an expanded file to CDN, defeats the purpose of using CDN.

Points to be noted,
a) I can not control the box which serves JS, its on CDN, I mentioned it.
b) I can use beautifiers etc but would that help me in debugging the script in run time? IMHO, no
c) Being bound by NDA and other legal things I can not share the script but its a generic problem, you can encounter it with a minified jQuery

Answer

rsp picture rsp · Mar 22, 2011
  1. Beautify your script
  2. Add the CDN host in /etc/hosts or your local DNS to resolve it to your own web server
  3. Host the beautified version and everything that you need on said web server
  4. Both Firefox and Chrome (versions as of this edit) support beautifying script with the {} button available in the inspector.