Skip to content

Commit

Permalink
fix(build): nested rewrites not working properly
Browse files Browse the repository at this point in the history
  • Loading branch information
brc-dd committed Aug 8, 2023
1 parent 481a5e3 commit 0f421d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/node/plugins/rewritesPlugin.ts
Expand Up @@ -7,7 +7,7 @@ export function resolveRewrites(
userRewrites: UserConfig['rewrites']
) {
const rewriteRules = Object.entries(userRewrites || {}).map(([from, to]) => ({
toPath: compile(to, { validate: false }),
toPath: compile(`/${to}`, { validate: false }),
matchUrl: match(from.startsWith('^') ? new RegExp(from) : from)
}))

Expand All @@ -18,7 +18,7 @@ export function resolveRewrites(
for (const { matchUrl, toPath } of rewriteRules) {
const res = matchUrl(page)
if (res) {
const dest = toPath(res.params)
const dest = toPath(res.params).slice(1)
pageToRewrite[page] = dest
rewriteToPage[dest] = page
break
Expand Down

0 comments on commit 0f421d7

Please sign in to comment.