diff --git a/src/utils/lazy.ts b/src/utils/lazy.ts index 439ec1bef..c3cb0f794 100644 --- a/src/utils/lazy.ts +++ b/src/utils/lazy.ts @@ -77,7 +77,13 @@ export function proxyLazy(factory: () => T, attempts = 5, isChild let isSameTick = true; if (!isChild) setTimeout(() => isSameTick = false, 0); - const proxyDummy = Object.assign(function ProxyDummy() { }, { + // Define the function in an object to preserve the name after minification + const dummyObj = { + ProxyDummy() { } + } as { ProxyDummy: any; }; + + const proxyDummy = dummyObj.ProxyDummy; + Object.assign(proxyDummy, { [proxyLazyGet]() { if (!proxyDummy[proxyLazyCache]) { // @ts-ignore @@ -99,6 +105,8 @@ export function proxyLazy(factory: () => T, attempts = 5, isChild [proxyLazyCache]: void 0 as T | undefined }); + delete dummyObj.ProxyDummy; + const proxy = new Proxy(proxyDummy, { ...handler, get(target, p) { diff --git a/src/utils/proxyInner.ts b/src/utils/proxyInner.ts index 51d62bdc4..4f6c67991 100644 --- a/src/utils/proxyInner.ts +++ b/src/utils/proxyInner.ts @@ -58,7 +58,13 @@ export function proxyInner( let isSameTick = true; if (!isChild) setTimeout(() => isSameTick = false, 0); - const proxyDummy = Object.assign(function ProxyDummy() { }, { + // Define the function in an object to preserve the name after minification + const dummyObj = { + ProxyDummy() { } + } as { ProxyDummy: any; }; + + const proxyDummy = dummyObj.ProxyDummy; + Object.assign(proxyDummy, { [proxyInnerGet]: function () { if (proxyDummy[proxyInnerValue] == null) { throw new Error(errMsg); @@ -69,6 +75,8 @@ export function proxyInner( [proxyInnerValue]: void 0 as T | undefined }); + delete dummyObj.ProxyDummy; + const proxy = new Proxy(proxyDummy, { ...handler, get(target, p) {