diff --git a/packages/core/src/htmlPlugin.ts b/packages/core/src/htmlPlugin.ts index 51039f1..b387f9c 100644 --- a/packages/core/src/htmlPlugin.ts +++ b/packages/core/src/htmlPlugin.ts @@ -355,8 +355,10 @@ function createRewire( return template } const isApiUrl = proxyUrlKeys.some((item) => - pathname.startsWith(path.resolve(baseUrl, item)), - ) + item[0] === '^' + ? new RegExp(item).test(pathname) + : pathname.startsWith(path.resolve(baseUrl, item)) + ); return isApiUrl ? parsedUrl.path : template }, }