Page 1 of 1

Breakpoints without debugger; statement

Posted: 03 December 2022, 02:09
by cranflavin
I'm hoping this is a tip that may help someone with debugging javascript more easily when using Chrome/Edge dev tools.

I noticed the dev wiki promotes using debugger; statements in javascript which requires making a code change to set a breakpoint. I'm assuming this is because refreshing via F5 tends to remove breakpoints due to some cache buster values that are added to the downloaded javascript filename. However, I found that adding the following line to the end of the javascript file helps resolve the issue by creating the proper source mapping.

Code: Select all

//# sourceURL=myfile.js
I updated the wiki to reflect this:

https://en.doc.boardgamearena.com/Pract ... yjsfile.js

Re: Breakpoints without debugger; statement

Posted: 03 December 2022, 02:12
by abcde
Thanks for the infor! It is very helpful!

Re: Breakpoints without debugger; statement

Posted: 03 December 2022, 12:14
by robinzig
That's actually really helpful - as it infuriates me that you lose browser breakpoints when you refresh. I'll likely be using this - thanks! :D