From f831767764030c77cc79db4cc860e7d76afc1b6a Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Thu, 15 Jun 2023 00:01:48 +0530 Subject: [PATCH] feat(build): allow using regex in rewrites --- src/node/plugins/rewritesPlugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node/plugins/rewritesPlugin.ts b/src/node/plugins/rewritesPlugin.ts index 868f7967..ebda4d4f 100644 --- a/src/node/plugins/rewritesPlugin.ts +++ b/src/node/plugins/rewritesPlugin.ts @@ -8,7 +8,7 @@ export function resolveRewrites( ) { const rewriteRules = Object.entries(userRewrites || {}).map(([from, to]) => ({ toPath: compile(to), - matchUrl: match(from) + matchUrl: match(from.startsWith('^') ? new RegExp(from) : from) })) const pageToRewrite: Record = {}