diff options
| -rw-r--r-- | packages/bun-framework-next/client.development.tsx | 13 | ||||
| -rw-r--r-- | packages/bun-framework-next/server-polyfills.tsx (renamed from packages/bun-framework-next/polyfills.tsx) | 0 | ||||
| -rw-r--r-- | packages/bun-framework-next/server.development.tsx | 2 |
3 files changed, 14 insertions, 1 deletions
diff --git a/packages/bun-framework-next/client.development.tsx b/packages/bun-framework-next/client.development.tsx index 2dcffe55c..d959b5ae1 100644 --- a/packages/bun-framework-next/client.development.tsx +++ b/packages/bun-framework-next/client.development.tsx @@ -1,6 +1,19 @@ 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 WeakMap(); + +globalThis.Object.freeze = function freeze(obj) { + freezer.set(freezer, true); +}; + +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/packages/bun-framework-next/polyfills.tsx b/packages/bun-framework-next/server-polyfills.tsx index 474ee6ec9..474ee6ec9 100644 --- a/packages/bun-framework-next/polyfills.tsx +++ b/packages/bun-framework-next/server-polyfills.tsx diff --git a/packages/bun-framework-next/server.development.tsx b/packages/bun-framework-next/server.development.tsx index afb6de4f1..96ba55812 100644 --- a/packages/bun-framework-next/server.development.tsx +++ b/packages/bun-framework-next/server.development.tsx @@ -1,5 +1,5 @@ import nextPackage from "next/package.json"; -import "./polyfills"; +import "./server-polyfills"; import { render } from "./renderDocument"; const { version } = nextPackage; |
