From 148e8481b73f22c5c8c36810540c9025cbf7b720 Mon Sep 17 00:00:00 2001 From: Xinyu Liu Date: Thu, 10 May 2018 21:01:19 +0800 Subject: [PATCH 1/2] 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 "${ From 494c459c523b6677bfaa769f04b77e2c60e99561 Mon Sep 17 00:00:00 2001 From: Xinyu Liu Date: Thu, 10 May 2018 21:44:56 +0800 Subject: [PATCH 2/2] tweaks --- lib/prepare.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/prepare.js b/lib/prepare.js index 2e384116db..39c09e01b1 100644 --- a/lib/prepare.js +++ b/lib/prepare.js @@ -138,7 +138,7 @@ async function resolveOptions (sourceDir) { try { themeLayoutPath = require.resolve(`vuepress-theme-${siteConfig.theme}/Layout.vue`, { paths: [ - path.resolve(__dirname), + path.resolve(__dirname, '../node_modules'), path.resolve(sourceDir) ] })