Skip to content

Commit 01142df

Browse files
meteorlxyulivz
authored andcommitted
fix: resolve custom theme from global cli (close: #392) (#399)
1 parent cefc8c3 commit 01142df

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/prepare.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,12 @@ async function resolveOptions (sourceDir) {
136136
if (siteConfig.theme) {
137137
// use external theme
138138
try {
139-
themeLayoutPath = require.resolve(`vuepress-theme-${siteConfig.theme}/Layout.vue`)
139+
themeLayoutPath = require.resolve(`vuepress-theme-${siteConfig.theme}/Layout.vue`, {
140+
paths: [
141+
path.resolve(__dirname, '../node_modules'),
142+
path.resolve(sourceDir)
143+
]
144+
})
140145
themePath = path.dirname(themeLayoutPath)
141146
} catch (e) {
142147
throw new Error(`[vuepress] Failed to load custom theme "${

0 commit comments

Comments
 (0)