diff --git a/src/utils/lazy.ts b/src/utils/lazy.ts index 986d4b3a7..fdc7a9e80 100644 --- a/src/utils/lazy.ts +++ b/src/utils/lazy.ts @@ -56,8 +56,9 @@ const handler: ProxyHandler = { return keys; }, getOwnPropertyDescriptor: (target, p) => { - if (typeof p === "string" && UNCONFIGURABLE_PROPERTIES.includes(p)) + if (typeof p === "string" && UNCONFIGURABLE_PROPERTIES.includes(p)) { return Reflect.getOwnPropertyDescriptor(target, p); + } const descriptor = Reflect.getOwnPropertyDescriptor(target[SYM_LAZY_GET](), p); if (descriptor) Object.defineProperty(target, p, descriptor); @@ -79,9 +80,7 @@ export function proxyLazy(factory: () => T, attempts = 5, isChild let isSameTick = true; if (!isChild) setTimeout(() => isSameTick = false, 0); - // Define the function in an object to preserve the name after minification - const proxyDummy = ({ ProxyDummy() { } }).ProxyDummy; - Object.assign(proxyDummy, { + const proxyDummy = Object.assign(function () { }, { [SYM_LAZY_GET]() { if (!proxyDummy[SYM_LAZY_CACHED]) { if (!get.$$vencordLazyFailed()) { diff --git a/src/utils/proxyInner.ts b/src/utils/proxyInner.ts index 27822962c..1dcd24e31 100644 --- a/src/utils/proxyInner.ts +++ b/src/utils/proxyInner.ts @@ -31,8 +31,9 @@ const handler: ProxyHandler = { return keys; }, getOwnPropertyDescriptor: (target, p) => { - if (typeof p === "string" && UNCONFIGURABLE_PROPERTIES.includes(p)) + if (typeof p === "string" && UNCONFIGURABLE_PROPERTIES.includes(p)) { return Reflect.getOwnPropertyDescriptor(target, p); + } const descriptor = Reflect.getOwnPropertyDescriptor(target[SYM_PROXY_INNER_GET](), p); if (descriptor) Object.defineProperty(target, p, descriptor); @@ -56,9 +57,7 @@ export function proxyInner( let isSameTick = true; if (!isChild) setTimeout(() => isSameTick = false, 0); - // Define the function in an object to preserve the name after minification - const proxyDummy = ({ ProxyDummy() { } }).ProxyDummy; - Object.assign(proxyDummy, { + const proxyDummy = Object.assign(function () { }, { [SYM_PROXY_INNER_GET]: function () { if (proxyDummy[SYM_PROXY_INNER_VALUE] == null) { throw new Error(errMsg);