feat(build): allow using regex in rewrites

pull/2465/merge
Divyansh Singh 1 year ago
parent b9eafac1d6
commit f831767764

@ -8,7 +8,7 @@ export function resolveRewrites(
) { ) {
const rewriteRules = Object.entries(userRewrites || {}).map(([from, to]) => ({ const rewriteRules = Object.entries(userRewrites || {}).map(([from, to]) => ({
toPath: compile(to), toPath: compile(to),
matchUrl: match(from) matchUrl: match(from.startsWith('^') ? new RegExp(from) : from)
})) }))
const pageToRewrite: Record<string, string> = {} const pageToRewrite: Record<string, string> = {}

Loading…
Cancel
Save