From 148e8481b73f22c5c8c36810540c9025cbf7b720 Mon Sep 17 00:00:00 2001 From: Xinyu Liu Date: Thu, 10 May 2018 21:01:19 +0800 Subject: [PATCH] fix: resolve custom theme from global cli (#392) --- lib/prepare.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/prepare.js b/lib/prepare.js index 49186a82d0..2e384116db 100644 --- a/lib/prepare.js +++ b/lib/prepare.js @@ -136,7 +136,12 @@ async function resolveOptions (sourceDir) { if (siteConfig.theme) { // use external theme try { - themeLayoutPath = require.resolve(`vuepress-theme-${siteConfig.theme}/Layout.vue`) + themeLayoutPath = require.resolve(`vuepress-theme-${siteConfig.theme}/Layout.vue`, { + paths: [ + path.resolve(__dirname), + path.resolve(sourceDir) + ] + }) themePath = path.dirname(themeLayoutPath) } catch (e) { throw new Error(`[vuepress] Failed to load custom theme "${