aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-04-29 21:14:21 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-04-29 21:14:21 -0700
commitbd1f9d8370ada6cc4fb145689a3b42f1d7da28a1 (patch)
tree4ad2d390860598d618f9b642ab3db42350860088
parent0cb090f1181e560cfe8e962cea38be062bfda80b (diff)
downloadbun-bd1f9d8370ada6cc4fb145689a3b42f1d7da28a1.tar.gz
bun-bd1f9d8370ada6cc4fb145689a3b42f1d7da28a1.tar.zst
bun-bd1f9d8370ada6cc4fb145689a3b42f1d7da28a1.zip
Fix some runtime issues caused by bundler
-rw-r--r--src/runtime.footer.bun.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/runtime.footer.bun.js b/src/runtime.footer.bun.js
index 520b89e89..fdf7cdefa 100644
--- a/src/runtime.footer.bun.js
+++ b/src/runtime.footer.bun.js
@@ -16,12 +16,17 @@ export var __decorateParam = BUN_RUNTIME.__decorateParam;
export var $$bun_runtime_json_parse = JSON.parse;
export var __internalIsCommonJSNamespace = BUN_RUNTIME.__internalIsCommonJSNamespace;
export var $$typeof = BUN_RUNTIME.$$typeof;
-export var __require = (globalThis.require ||= function (moduleId) {
+export var __require = function (moduleId) {
if (typeof moduleId === "string") {
return import.meta.require(moduleId);
}
- return BUN_RUNTIME.__require(moduleId);
-});
-__require.d ||= BUN_RUNTIME.__require.d;
+ if (__internalIsCommonJSNamespace(moduleId)) {
+ return moduleId.default();
+ }
+
+ return moduleId;
+};
+__require.d = BUN_RUNTIME.__require.d;
+globalThis.require ||= __require;
globalThis.__internalIsCommonJSNamespace ||= BUN_RUNTIME.__internalIsCommonJSNamespace;