JS: fix UMD wrapper for case when 'exports' exists, but is null

This commit is contained in:
Alexey Andreev 2023-10-11 14:01:24 +02:00
parent d33c491a33
commit 70540b2df0

View File

@ -539,6 +539,7 @@ public class JavaScriptTarget implements TeaVMTarget, TeaVMJavaScriptHost {
writer.appendElseIf().append("typeof exports").ws() writer.appendElseIf().append("typeof exports").ws()
.append("===").ws().append("'object'").ws().append("&&").ws() .append("===").ws().append("'object'").ws().append("&&").ws()
.append("exports").ws().append("!==").ws().append("null").ws().append("&&").ws()
.append("typeof exports.nodeName").ws().append("!==").ws().append("'string')").appendBlockStart(); .append("typeof exports.nodeName").ws().append("!==").ws().append("'string')").appendBlockStart();
writer.append("module(global,").ws().append("exports"); writer.append("module(global,").ws().append("exports");
for (var moduleName : importedModules.keySet()) { for (var moduleName : importedModules.keySet()) {