Bug fix: Node.js was being treated as a web worker context.

This commit is contained in:
Joseph Cloutier
2024-06-10 14:07:22 -04:00
parent fc393eabd1
commit 8066037cdd
2 changed files with 3 additions and 6 deletions

View File

@@ -161,7 +161,7 @@ class HTML5Platform extends PlatformTarget
var script = File.getContent(dependency.path);
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);
}