Bug fix: Node.js was being treated as a web worker context.
This commit is contained in:
@@ -1,10 +1,7 @@
|
|||||||
(function ($hx_exports, $global) { "use strict"; var $hx_script = (function (exports, global) { ::SOURCE_FILE::
|
(function ($hx_exports, $global) { "use strict"; var $hx_script = (function (exports, global) { ::SOURCE_FILE::
|
||||||
});
|
});
|
||||||
::if false::
|
if (typeof self !== "undefined" && self.constructor.name.includes("Worker")) {
|
||||||
If `window` is undefined, it means this script is running as a web worker.
|
// No need for exports in a worker context, just initialize statics.
|
||||||
In that case, there's no need for exports, and all we need to do is run the
|
|
||||||
static initializers.
|
|
||||||
::end::if(typeof window == "undefined") {
|
|
||||||
$hx_script({}, $global);
|
$hx_script({}, $global);
|
||||||
} else {
|
} else {
|
||||||
$hx_exports.lime = $hx_exports.lime || {};
|
$hx_exports.lime = $hx_exports.lime || {};
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ class HTML5Platform extends PlatformTarget
|
|||||||
var script = File.getContent(dependency.path);
|
var script = File.getContent(dependency.path);
|
||||||
if (!dependency.webWorker)
|
if (!dependency.webWorker)
|
||||||
{
|
{
|
||||||
script = 'if(typeof window != "undefined") {\n' + script + "\n}";
|
script = 'if(typeof self === "undefined" || !self.constructor.name.includes("Worker")) { $script }';
|
||||||
}
|
}
|
||||||
context.embeddedLibraries.push(script);
|
context.embeddedLibraries.push(script);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user