From 70540b2df06cb8d1afa9efb743d9738ee41f16c5 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Wed, 11 Oct 2023 14:01:24 +0200 Subject: [PATCH] JS: fix UMD wrapper for case when 'exports' exists, but is null --- .../main/java/org/teavm/backend/javascript/JavaScriptTarget.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/main/java/org/teavm/backend/javascript/JavaScriptTarget.java b/core/src/main/java/org/teavm/backend/javascript/JavaScriptTarget.java index f87538235..2ee2ec5f9 100644 --- a/core/src/main/java/org/teavm/backend/javascript/JavaScriptTarget.java +++ b/core/src/main/java/org/teavm/backend/javascript/JavaScriptTarget.java @@ -539,6 +539,7 @@ public class JavaScriptTarget implements TeaVMTarget, TeaVMJavaScriptHost { writer.appendElseIf().append("typeof exports").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(); writer.append("module(global,").ws().append("exports"); for (var moduleName : importedModules.keySet()) {