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 bbcb8bea07
This commit is contained in:
Josh Tynjala
2024-12-09 09:21:57 -08:00
parent d6e20eb987
commit c81ad95ae5

View File

@@ -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);