How to debug javascript

Hi everyone!

I’m seeing a strange problem in the “Meetings” module: basically, SugarCRM doesn’t consider that I’m using 24-hours datetimes. So for example if I schedule a meeting starting at 11:00 (AM) and set a “3 Hours” duration, the proposed end time becomes 2:00 instead of 14:00.

I’d like to debug the javascript code responsible for this, directly from inside the browser, so my question is: what is the recommend way to tell SugarCRM to load the uncompressed non-minified version of the javascript files?

Thanks!

If you are using chrome, you can unminify the javascript in the browser. In the dev tools on the Sources tab, find the javascript file and then click on the {} brackets at the bottom of the screen.

Nice! I see there’s a “pretty print” option in Firefox too :slight_smile: This helps a lot, even if there are still some difficulties (for example if you get a warning on the console it’s not easy to tell the “real line” that the message is referring to)

Thanks for your help!

Hi everyone!
I’m facing this problem again, but this time the javascript I’d like to debug is minified, so pretty-printing it isn’t much help… :frowning: So my question comes back: is there a way to tell SuiteCRM to load the uncompressed non-minified version of the javascript files?

I’d quite like to know the answer to this, too.

Have you tried turning on developer mode? I remember it changes something in the way JS is cached, but I am not sure if it is related to the minified files.

On my test installation developerMode is always on, so I think it’s not related.
(At least up to SuiteCRM 7.10.12)

I asked a more experienced developer and he says he doesn’t know of a way to avoid looking a minified code when debugging. Just pretty-print and breakpoints, that’s it…

I see, thanks! Well it looks like a good opportunity for a PR :smiley:

1 Like