From c0c897fc237df5e60be759966a12c8e2478ee9ef Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Wed, 15 May 2024 23:00:21 -0300 Subject: [PATCH] extractAndLoadChunksLazy: Cache result to avoid searching factories everytime --- src/webpack/webpack.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/webpack/webpack.ts b/src/webpack/webpack.ts index 8ea6713..0bee08f 100644 --- a/src/webpack/webpack.ts +++ b/src/webpack/webpack.ts @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import { proxyLazy } from "@utils/lazy"; +import { makeLazy, proxyLazy } from "@utils/lazy"; import { LazyComponent } from "@utils/lazyReact"; import { Logger } from "@utils/Logger"; import { canonicalizeMatch } from "@utils/patches"; @@ -462,7 +462,7 @@ export async function extractAndLoadChunks(code: string[], matcher: RegExp = Def export function extractAndLoadChunksLazy(code: string[], matcher = DefaultExtractAndLoadChunksRegex) { if (IS_DEV) lazyWebpackSearchHistory.push(["extractAndLoadChunks", [code, matcher]]); - return () => extractAndLoadChunks(code, matcher); + return makeLazy(() => extractAndLoadChunks(code, matcher)); } /**