From 66fa7e3f500da563bc78bf193fe694eeae32ec71 Mon Sep 17 00:00:00 2001 From: Delusoire Date: Thu, 8 Aug 2024 07:55:10 +0100 Subject: [PATCH] fix ReactRouter useMatch --- modules/stdlib/src/webpack/ReactRouter.xpui.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/stdlib/src/webpack/ReactRouter.xpui.ts b/modules/stdlib/src/webpack/ReactRouter.xpui.ts index 8548cbc..1bc85b2 100644 --- a/modules/stdlib/src/webpack/ReactRouter.xpui.ts +++ b/modules/stdlib/src/webpack/ReactRouter.xpui.ts @@ -12,7 +12,6 @@ const [ReactRouterModuleID] = chunks.find(([_, v]) => v.toString().includes("Rea const ReactRouterModule = Object.values(require(ReactRouterModuleID)); // https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/hooks.tsx#L131 -export const useMatch: Function = findBy( - "let{pathname:", - /\(([a-zA-Z_\$][\w\$]*),([a-zA-Z_\$][\w\$]*)\)\),\[\2,\1\]/, -)(ReactRouterModule); +export const useMatch: Function = ReactRouterModule.find((f) => + f.toString().includes("let{pathname:") && !f.toString().includes(".createElement(") +);