Skip to content

Commit

Permalink
fix: rewrite rules for RegExpr proxy urls
Browse files Browse the repository at this point in the history
  • Loading branch information
xv2 committed Aug 2, 2024
1 parent 4a32df2 commit 3899dda
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/core/src/htmlPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
}
Expand Down

0 comments on commit 3899dda

Please sign in to comment.