From 14b51ef57c289f6a2622e0848b11d757183cd24d Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Mon, 8 Nov 2021 15:53:37 -0800 Subject: Disable Object.freeze --- src/runtime.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') 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 }); -- cgit v1.2.3