mirror of
https://github.com/docsifyjs/docsify.git
synced 2025-12-08 19:55:52 +00:00
fix(ssr): file path
This commit is contained in:
parent
81c87f7926
commit
79a83bc17d
@ -5,6 +5,7 @@ import { Compiler } from '../../src/core/render/compiler'
|
||||
import { isAbsolutePath } from '../../src/core/router/util'
|
||||
import { readFileSync } from 'fs'
|
||||
import { resolve, basename } from 'path'
|
||||
import resolvePathname from 'resolve-pathname'
|
||||
|
||||
function cwd (...args) {
|
||||
return resolve(process.cwd(), ...args)
|
||||
@ -131,7 +132,7 @@ export default class Renderer {
|
||||
|
||||
const fileName = basename(filePath)
|
||||
|
||||
return await this._loadFile(cwd(filePath, '../..', fileName))
|
||||
return await this._loadFile(resolvePathname(`../${fileName}`, filePath))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ export function getPath (...args) {
|
||||
}
|
||||
|
||||
export const isAbsolutePath = cached(path => {
|
||||
return /(:|(\/{2}))/.test(path)
|
||||
return /(:|(\/{2}))/g.test(path)
|
||||
})
|
||||
|
||||
export const getParentPath = cached(path => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user