From 8f2429576005d42e248e5b16d3b1dde23718a039 Mon Sep 17 00:00:00 2001 From: Hrishikesh Kokate Date: Sun, 28 Jul 2024 23:00:08 +0530 Subject: [PATCH 1/2] fix: crypto missing in polyfill Reported by customer: https://answers.netlify.com/t/122805 --- src/helpers/setUpEdgeFunction.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/helpers/setUpEdgeFunction.js b/src/helpers/setUpEdgeFunction.js index d035b32a..490618dc 100644 --- a/src/helpers/setUpEdgeFunction.js +++ b/src/helpers/setUpEdgeFunction.js @@ -89,7 +89,9 @@ const setUpEdgeFunction = async ({ angularJson, constants, failBuild }) => { // we ensure this is initialised before any other module const polyfills = ` import process from "node:process" + import crypto from "node:crypto" + globalThis.crypto = crypto globalThis.process = process globalThis.DenoEvent = globalThis.Event // storing this for fixup-event.mjs ` From fc53ae6ad48ddee9a56a34bf66aa5ab24891a8f6 Mon Sep 17 00:00:00 2001 From: Hrishikesh Kokate Date: Sun, 28 Jul 2024 23:03:39 +0530 Subject: [PATCH 2/2] try sk-style --- src/helpers/setUpEdgeFunction.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/helpers/setUpEdgeFunction.js b/src/helpers/setUpEdgeFunction.js index 490618dc..bb486f8c 100644 --- a/src/helpers/setUpEdgeFunction.js +++ b/src/helpers/setUpEdgeFunction.js @@ -91,7 +91,12 @@ const setUpEdgeFunction = async ({ angularJson, constants, failBuild }) => { import process from "node:process" import crypto from "node:crypto" - globalThis.crypto = crypto + Object.defineProperty(globalThis, 'crypto', { + configurable: true, + enumerable: true, + value: crypto, + writable: true + }) globalThis.process = process globalThis.DenoEvent = globalThis.Event // storing this for fixup-event.mjs `