From 3adadffc0e62abd9c92c78bd8ffd04545ab62441 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Tue, 16 May 2023 11:42:55 -0700 Subject: [PATCH] Fixes #2895 --- src/bundler/entry_points.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bundler/entry_points.zig b/src/bundler/entry_points.zig index ff0b7983431283..b8414a9a5071c2 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) => {{