From 54290a32d1f183ab4e2909f9c8c988c915f85b19 Mon Sep 17 00:00:00 2001 From: baozouai Date: Tue, 19 Mar 2024 21:03:32 +0800 Subject: [PATCH] fix: support windows separator --- src/generate-history-method-webpack-plugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/generate-history-method-webpack-plugin.ts b/src/generate-history-method-webpack-plugin.ts index 6717348..2edfa9e 100644 --- a/src/generate-history-method-webpack-plugin.ts +++ b/src/generate-history-method-webpack-plugin.ts @@ -243,7 +243,7 @@ export function Router({ children, basename }${isExistTS ? ': RouterProps' : ''} getParamsMapAndUrlObj(files: string[]) { // { formatPath => paramsPath } const paramsMap: Record = {} - const regExp = new RegExp(`\/${this.pageName.replace(/(?=\.)/g, '\\')}\.(tsx|jsx?)$`) + const regExp = new RegExp(`[\/\\\\]${this.pageName.replace(/(?=\.)/g, '\\')}\.(tsx|jsx?)$`) // { formatPath => urlPath } const urlObj = files.reduce>((pre, path) => { // eg: path: Users/xxx/project/src/pages/order/ ~ q/index.page.tsx