fix: resolve custom theme from global cli (close: #392) (#399)

This commit is contained in:
Liu Xinyu
2018-05-10 21:50:59 +08:00
committed by ULIVZ
parent cefc8c30c4
commit 01142df691
+6 -1
View File
@@ -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, '../node_modules'),
path.resolve(sourceDir)
]
})
themePath = path.dirname(themeLayoutPath)
} catch (e) {
throw new Error(`[vuepress] Failed to load custom theme "${