Dojo cacheBust setting (JS requests with timestamp in URL) breaks debugging

Game development with Board Game Arena Studio
Post Reply
Fritz
Posts: 5
Joined: 11 March 2019, 22:41

Dojo cacheBust setting (JS requests with timestamp in URL) breaks debugging

Post by Fritz »

On BGA studio, the dojoConfig option "cacheBust" is set to true. While I understand the purpose, it makes debugging the game startup unnecessarily hard. Also, it is actually unnecessary, because any web developer should know to always enable the "Disable Cache" setting in the developer tools.

To illustrate the problem, imagine the following situation:

Some function in the game initialization fails. So you set a breakpoint in your setup() JavaScript function in the file mygame.js, then reload the page. Normally, the breakpoint would trigger, because the file name (the URL) stays the same between two requests.

However, since cacheBust appends the timestamp to the URL, your breakpoint is not in mygame.js, but in mygame.js?1587040282609. And when you reload, it loads mygame.js?1587040266666 instead, because some time passed. So your breakpoint is gone, the debugger doesn't stop in your setup() function, and your app crashes again...

The obvious fix would be to set dojoConfig.cacheBust = false, but that has to happen before dojo.js is loaded, and there seems to be no way I can inject code at that point.

Apart from that, I can only insert a "debugger;" statement in the javascript file, which pauses the execution at that point. But that only works if I want a breakpoint in a file I can modify, not for example in ly_studio.js.
Post Reply

Return to “Developers”