Skip to content

Commit 0f421d7

Browse files
committedAug 8, 2023
fix(build): nested rewrites not working properly
1 parent 481a5e3 commit 0f421d7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎src/node/plugins/rewritesPlugin.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export function resolveRewrites(
77
userRewrites: UserConfig['rewrites']
88
) {
99
const rewriteRules = Object.entries(userRewrites || {}).map(([from, to]) => ({
10-
toPath: compile(to, { validate: false }),
10+
toPath: compile(`/${to}`, { validate: false }),
1111
matchUrl: match(from.startsWith('^') ? new RegExp(from) : from)
1212
}))
1313

@@ -18,7 +18,7 @@ export function resolveRewrites(
1818
for (const { matchUrl, toPath } of rewriteRules) {
1919
const res = matchUrl(page)
2020
if (res) {
21-
const dest = toPath(res.params)
21+
const dest = toPath(res.params).slice(1)
2222
pageToRewrite[page] = dest
2323
rewriteToPage[dest] = page
2424
break

0 commit comments

Comments
 (0)
Please sign in to comment.