aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-11-08 15:53:37 -0800
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-11-08 15:53:37 -0800
commit14b51ef57c289f6a2622e0848b11d757183cd24d (patch)
treeffdeda9aa1552189bf5a3dcf7c4ee1bf1a80e8cf
parent7a836382b3ca96f7b0d2f94db4d1431949c4d24a (diff)
downloadbun-14b51ef57c289f6a2622e0848b11d757183cd24d.tar.gz
bun-14b51ef57c289f6a2622e0848b11d757183cd24d.tar.zst
bun-14b51ef57c289f6a2622e0848b11d757183cd24d.zip
Disable Object.freeze
-rw-r--r--packages/bun-framework-next/client.development.tsx14
-rw-r--r--src/runtime.js14
2 files changed, 14 insertions, 14 deletions
diff --git a/packages/bun-framework-next/client.development.tsx b/packages/bun-framework-next/client.development.tsx
index 5f25619ce..2dcffe55c 100644
--- a/packages/bun-framework-next/client.development.tsx
+++ b/packages/bun-framework-next/client.development.tsx
@@ -1,20 +1,6 @@
globalThis.global = globalThis;
globalThis.Bun_disableCSSImports = true;
-// We're disabling Object.freeze because it breaks CJS => ESM and can cause
-// issues with Suspense and other things that expect the CJS module namespace
-// to be mutable when the ESM module namespace is NOT mutable
-const freezer = new WeakSet();
-
-globalThis.Object.freeze = function freeze(obj) {
- freezer.add(obj);
- return obj;
-};
-
-globalThis.Object.isFrozen = function isFrozen(obj) {
- return freezer.has(obj);
-};
-
import * as React from "react";
var onlyChildPolyfill = React.Children.only;
React.Children.only = function (children) {
diff --git a/src/runtime.js b/src/runtime.js
index 07219436d..1e86ef3b6 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -6,6 +6,20 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
+// We're disabling Object.freeze because it breaks CJS => ESM and can cause
+// issues with Suspense and other things that expect the CJS module namespace
+// to be mutable when the ESM module namespace is NOT mutable
+var __objectFreezePolyfill = new WeakSet();
+
+globalThis.Object.freeze = function freeze(obj) {
+ __objectFreezePolyfill.add(obj);
+ return obj;
+};
+
+globalThis.Object.isFrozen = function isFrozen(obj) {
+ return __objectFreezePolyfill.has(obj);
+};
+
export var __markAsModule = (target) =>
__defProp(target, "__esModule", { value: true, configurable: true });