Skip to content

Commit 494c634

Browse files
authored
fix(theme): local search get 404 on build when use route rewrites in windows (#2301)
1 parent 69c7646 commit 494c634

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/node/plugins/localSearchPlugin.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import fs from 'fs-extra'
55
import _debug from 'debug'
66
import type { SiteConfig } from '../config'
77
import { createMarkdownRenderer } from '../markdown/markdown'
8-
import { resolveSiteDataByRoute } from '../shared'
8+
import { resolveSiteDataByRoute, slash } from '../shared'
99

1010
const debug = _debug('vitepress:local-search')
1111

@@ -95,7 +95,7 @@ export async function localSearchPlugin(
9595
}
9696

9797
function getDocId(file: string) {
98-
let relFile = path.relative(siteConfig.srcDir, file)
98+
let relFile = slash(path.relative(siteConfig.srcDir, file))
9999
relFile = siteConfig.rewrites.map[relFile] || relFile
100100
let id = path.join(siteConfig.site.base, relFile)
101101
id = id.replace(/\/index\.md$/, '/')

0 commit comments

Comments
 (0)