Skip to content

Commit

Permalink
output.js: fix broken breakpoints in debug builds (closes #1872)
Browse files Browse the repository at this point in the history
::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 bbcb8be
  • Loading branch information
joshtynjala committed Dec 9, 2024
1 parent d6e20eb commit c81ad95
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions templates/html5/output.js
Original file line number Diff line number Diff line change
@@ -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);
Expand Down

0 comments on commit c81ad95

Please sign in to comment.