diff options
-rw-r--r-- | src/bundler/entry_points.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/bundler/entry_points.zig b/src/bundler/entry_points.zig index ff0b79834..b8414a9a5 100644 --- a/src/bundler/entry_points.zig +++ b/src/bundler/entry_points.zig @@ -190,9 +190,9 @@ pub const ServerEntryPoint = struct { \\export * from '{s}{s}'; \\var entryNamespace = start; \\var cjs = start?.default; - \\if (cjs && cjsSymbol in cjs) {{ + \\if (cjs && typeof cjs === 'function' && cjsSymbol in cjs) {{ \\ // if you module.exports = (class {{}}), don't call it - \\ entryNamespace = import.meta.primordials.isCallable(cjs) ? cjs() : cjs; + \\ entryNamespace = ("prototype" in cjs) ? cjs : cjs(); \\}} \\if (typeof entryNamespace?.then === 'function') {{ \\ entryNamespace = entryNamespace.then((entryNamespace) => {{ @@ -233,9 +233,9 @@ pub const ServerEntryPoint = struct { \\export * from '{s}{s}'; \\var entryNamespace = start; \\var cjs = start?.default; - \\if (cjs && cjsSymbol in cjs) {{ + \\if (cjs && typeof cjs === 'function' && cjsSymbol in cjs) {{ \\ // if you module.exports = (class {{}}), don't call it - \\ entryNamespace = import.meta.primordials.isCallable(cjs) ? cjs() : cjs; + \\ entryNamespace = ("prototype" in cjs) ? cjs : cjs(); \\}} \\if (typeof entryNamespace?.then === 'function') {{ \\ entryNamespace = entryNamespace.then((entryNamespace) => {{ |