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()) {