We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
yyx990803
kiaking
brc-dd
posva
Learn more about funding links in repositories.
Report abuse
1 parent 481a5e3 commit 0f421d7Copy full SHA for 0f421d7
src/node/plugins/rewritesPlugin.ts
@@ -7,7 +7,7 @@ export function resolveRewrites(
7
userRewrites: UserConfig['rewrites']
8
) {
9
const rewriteRules = Object.entries(userRewrites || {}).map(([from, to]) => ({
10
- toPath: compile(to, { validate: false }),
+ toPath: compile(`/${to}`, { validate: false }),
11
matchUrl: match(from.startsWith('^') ? new RegExp(from) : from)
12
}))
13
@@ -18,7 +18,7 @@ export function resolveRewrites(
18
for (const { matchUrl, toPath } of rewriteRules) {
19
const res = matchUrl(page)
20
if (res) {
21
- const dest = toPath(res.params)
+ const dest = toPath(res.params).slice(1)
22
pageToRewrite[page] = dest
23
rewriteToPage[dest] = page
24
break
0 commit comments