diff options
| author | 2021-11-08 15:47:58 -0800 | |
|---|---|---|
| committer | 2021-11-08 15:47:58 -0800 | |
| commit | 360dec4fb978b780bd6ef764f6d65977743e1b42 (patch) | |
| tree | a740640667278885b6b2ae3be2e71a41b0a61296 | |
| parent | 241525947c033de9a8a46abfb8f064cc95a5c0b0 (diff) | |
| parent | 83cf1be2b93bff3c11c88da4a6f50d6f932a1779 (diff) | |
| download | bun-360dec4fb978b780bd6ef764f6d65977743e1b42.tar.gz bun-360dec4fb978b780bd6ef764f6d65977743e1b42.tar.zst bun-360dec4fb978b780bd6ef764f6d65977743e1b42.zip | |
Merge pull request #61 from Jarred-Sumner/tweak-bun-framework-next
Rename polyfills, polyfill Object.feeze
| -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; |
