diff options
author | 2023-05-16 11:42:55 -0700 | |
---|---|---|
committer | 2023-05-16 11:43:09 -0700 | |
commit | 3adadffc0e62abd9c92c78bd8ffd04545ab62441 (patch) | |
tree | a1f9efc3e36434d79220a7e88a711c3fd420a42c | |
parent | 366eba78f0b9b2c58cdd46b906275fc8382da977 (diff) | |
download | bun-3adadffc0e62abd9c92c78bd8ffd04545ab62441.tar.gz bun-3adadffc0e62abd9c92c78bd8ffd04545ab62441.tar.zst bun-3adadffc0e62abd9c92c78bd8ffd04545ab62441.zip |
Fixes #2895
-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) => {{ |