diff --git a/src/plugins/startupTimings/index.tsx b/src/plugins/startupTimings/index.tsx index c7417f0f..742d822a 100644 --- a/src/plugins/startupTimings/index.tsx +++ b/src/plugins/startupTimings/index.tsx @@ -17,9 +17,10 @@ */ import { Devs } from "@utils/constants"; -import { LazyComponent } from "@utils/react"; import definePlugin from "@utils/types"; +import StartupTimingPage from "./StartupTimingPage"; + export default definePlugin({ name: "StartupTimings", description: "Adds Startup Timings to the Settings menu", @@ -31,5 +32,5 @@ export default definePlugin({ replace: '{section:"StartupTimings",label:"Startup Timings",element:$self.StartupTimingPage},$&' } }], - StartupTimingPage: LazyComponent(() => require("./StartupTimingPage").default) + StartupTimingPage }); diff --git a/src/utils/lazy.ts b/src/utils/lazy.ts index 32336fb4..a61785df 100644 --- a/src/utils/lazy.ts +++ b/src/utils/lazy.ts @@ -116,8 +116,11 @@ export function proxyLazy(factory: () => T, attempts = 5, isChild = false): T attempts, true ); - - return Reflect.get(target[kGET](), p, receiver); + const lazyTarget = target[kGET](); + if (typeof lazyTarget === "object" || typeof lazyTarget === "function") { + return Reflect.get(lazyTarget, p, receiver); + } + throw new Error("proxyLazy called on a primitive value"); } }) as any; }