fix(ssr): add debug

This commit is contained in:
qingwei.li 2017-05-30 16:16:36 +08:00
parent 8cb4189b96
commit 6b9e0922cf
No known key found for this signature in database
GPG Key ID: B6DDC2F7AE80B2F4
2 changed files with 4 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import { isAbsolutePath } from '../../src/core/router/util'
import { readFileSync } from 'fs' import { readFileSync } from 'fs'
import { resolve, basename } from 'path' import { resolve, basename } from 'path'
import resolvePathname from 'resolve-pathname' import resolvePathname from 'resolve-pathname'
import debug from 'debug'
function cwd (...args) { function cwd (...args) {
return resolve(process.cwd(), ...args) return resolve(process.cwd(), ...args)
@ -112,10 +113,12 @@ export default class Renderer {
} }
async _loadFile (filePath) { async _loadFile (filePath) {
debug('docsify')(`load > ${filePath}`)
let content let content
try { try {
if (isAbsolutePath(filePath)) { if (isAbsolutePath(filePath)) {
const res = await fetch(filePath) const res = await fetch(filePath)
if (!res.ok) throw Error()
content = await res.text() content = await res.text()
this.lock = 0 this.lock = 0
} else { } else {

View File

@ -15,6 +15,7 @@
"test": "echo 'hello'" "test": "echo 'hello'"
}, },
"dependencies": { "dependencies": {
"debug": "^2.6.8",
"node-fetch": "^1.7.0", "node-fetch": "^1.7.0",
"resolve-pathname": "^2.1.0" "resolve-pathname": "^2.1.0"
} }