From c81ad95ae530c670de2f5bc5f8909e49d46c1a89 Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Mon, 9 Dec 2024 09:21:57 -0800 Subject: [PATCH] output.js: fix broken breakpoints in debug builds (closes #1872) ::SOURCE_FILE:: must appear on the first line so that the .js.map line numbers match with our generated .js file line numbers Added a comment to explain why that part of the file isn't formatted nicely with line breaks like the rest of the file. This partially reverts bbcb8bea078b8e505908c40e3c64e516a23897ae --- templates/html5/output.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/templates/html5/output.js b/templates/html5/output.js index da522b6ca..e04a25744 100644 --- a/templates/html5/output.js +++ b/templates/html5/output.js @@ -1,10 +1,17 @@ -var $lime_init = (function ($hx_exports, $global) { - "use strict"; +var $lime_init = (function ($hx_exports, $global) { "use strict"; var $hx_script = (function (exports, global) { ::SOURCE_FILE:: +});::if false:: +/* + Don't insert or remove any line breaks in the code above this line! - var $hx_script = (function (exports, global) { -::SOURCE_FILE:: - }); + ::SOURCE_FILE:: must start on the first line. + Breakpoints in debug builds won't work if this file's line numbers don't + match the .js.map file's expected line numbers exactly. + + Additionally, the }); after ::SOURCE_FILE:: must appear on the next line + to avoid it getting ignored in a // comment at the end of ::SOURCE_FILE::. +*/ +::end:: if (typeof self !== "undefined" && self.constructor.name.includes("Worker")) { // No need for exports in a worker context, just initialize statics. $hx_script({}, $global);