This commit is contained in:
RotCool 2025-07-25 02:21:22 +00:00 committed by GitHub
commit 5a74a65cff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

View File

@ -21,7 +21,8 @@ export function getFunctions(server: ViteDevServer, devtoolsOptions: ValaxyDevto
// const userRoot = server.config.root
function getRoutePath(filePath: string) {
const relativePath = path.relative(path.resolve(userRoot, 'pages'), filePath).slice(0, -'.md'.length)
// convert \ to / to ensure compatibility with different OS
const relativePath = path.relative(path.resolve(userRoot, 'pages'), filePath).slice(0, -'.md'.length).replace(/\\/g, '/')
return ensurePrefix('/', relativePath)
}
@ -33,7 +34,7 @@ export function getFunctions(server: ViteDevServer, devtoolsOptions: ValaxyDevto
},
async getPostList() {
const files = await fg(`${userRoot}/pages/posts/**/*.md`)
const files = await fg(`${userRoot}/pages/posts/**/*.md`.replaceAll('\\', '/'))
const posts = []
for await (const file of files) {