Skip to content

Commit 3899dda

Browse files
committed
fix: rewrite rules for RegExpr proxy urls
1 parent 4a32df2 commit 3899dda

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/core/src/htmlPlugin.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,10 @@ function createRewire(
355355
return template
356356
}
357357
const isApiUrl = proxyUrlKeys.some((item) =>
358-
pathname.startsWith(path.resolve(baseUrl, item)),
359-
)
358+
item[0] === '^'
359+
? new RegExp(item).test(pathname)
360+
: pathname.startsWith(path.resolve(baseUrl, item))
361+
);
360362
return isApiUrl ? parsedUrl.path : template
361363
},
362364
}

0 commit comments

Comments
 (0)