From fc9413a6d04fcb7d5be469746720d6a223a73a45 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Thu, 15 Dec 2022 14:24:54 +0100 Subject: [PATCH] fix(replay): Ensure lodash.debounce does not trigger next.js warning lodash.debounce uses `Function('')`, which nextjs interprets as unsafe, and does not work there. See: https://github.com/lodash/lodash/issues/5394 We don't really need that fallback anyhow, `global || self` should be fine for us. --- patches/lodash.debounce+4.0.8.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 patches/lodash.debounce+4.0.8.patch diff --git a/patches/lodash.debounce+4.0.8.patch b/patches/lodash.debounce+4.0.8.patch new file mode 100644 index 000000000000..3a07dbb0bc5e --- /dev/null +++ b/patches/lodash.debounce+4.0.8.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/lodash.debounce/index.js b/node_modules/lodash.debounce/index.js +index ac5707d..7447acd 100644 +--- a/node_modules/lodash.debounce/index.js ++++ b/node_modules/lodash.debounce/index.js +@@ -38,7 +38,7 @@ var freeGlobal = typeof global == 'object' && global && global.Object === Object + var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + + /** Used as a reference to the global object. */ +-var root = freeGlobal || freeSelf || Function('return this')(); ++var root = freeGlobal || freeSelf; + + /** Used for built-in method references. */ + var objectProto = Object.prototype;