Breakpoints without debugger; statement

Game development with Board Game Arena Studio
Post Reply
cranflavin
Posts: 4
Joined: 12 November 2022, 01:12

Breakpoints without debugger; statement

Post 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
User avatar
abcde
Posts: 22
Joined: 24 January 2014, 18:30

Re: Breakpoints without debugger; statement

Post by abcde »

Thanks for the infor! It is very helpful!
User avatar
robinzig
Posts: 406
Joined: 11 February 2021, 18:23

Re: Breakpoints without debugger; statement

Post 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
Post Reply

Return to “Developers”