diff --git a/packages/docsify-server-renderer/index.js b/packages/docsify-server-renderer/index.js index 80cbf42be..62081ffb7 100644 --- a/packages/docsify-server-renderer/index.js +++ b/packages/docsify-server-renderer/index.js @@ -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) @@ -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 { diff --git a/packages/docsify-server-renderer/package.json b/packages/docsify-server-renderer/package.json index 74f33dfea..94b053d59 100644 --- a/packages/docsify-server-renderer/package.json +++ b/packages/docsify-server-renderer/package.json @@ -15,6 +15,7 @@ "test": "echo 'hello'" }, "dependencies": { + "debug": "^2.6.8", "node-fetch": "^1.7.0", "resolve-pathname": "^2.1.0" }