Skip to content

Commit

Permalink
fix(ssr): add debug
Browse files Browse the repository at this point in the history
  • Loading branch information
QingWei-Li committed May 30, 2017
1 parent 8cb4189 commit 6b9e092
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/docsify-server-renderer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { isAbsolutePath } from '../../src/core/router/util'
import { readFileSync } from 'fs'
import { resolve, basename } from 'path'
import resolvePathname from 'resolve-pathname'
import debug from 'debug'

function cwd (...args) {
return resolve(process.cwd(), ...args)
Expand Down Expand Up @@ -112,10 +113,12 @@ export default class Renderer {
}

async _loadFile (filePath) {
debug('docsify')(`load > ${filePath}`)
let content
try {
if (isAbsolutePath(filePath)) {
const res = await fetch(filePath)
if (!res.ok) throw Error()
content = await res.text()
this.lock = 0
} else {
Expand Down
1 change: 1 addition & 0 deletions packages/docsify-server-renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"test": "echo 'hello'"
},
"dependencies": {
"debug": "^2.6.8",
"node-fetch": "^1.7.0",
"resolve-pathname": "^2.1.0"
}
Expand Down

0 comments on commit 6b9e092

Please sign in to comment.