How to effectively debug minified JS files?

Sergey Solomatin picture Sergey Solomatin · Jul 14, 2016 · Viewed 17k times · Source

I've got problem debugging minified JS on production server.

While you can't catch some errors on your machine while testing dev/prod servers, there's an opportunity to send some frontend errors and exceptions from users to a special log.

When JS files are minified, debugging this code becomes a hell.
What are the best practices in performing such work?

Answer

Mettin Parzinski picture Mettin Parzinski · Jul 14, 2016

Biting the bullet ;) In chrome you can auto format the minified code from the sources panel click the brackets icon in the bottom left to format

Then you can add debugger statements by clicking the line numbers. Run your code and find out more...

add debugger by clicking line number