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