diff --git a/lib/prepare.js b/lib/prepare.js index 49186a82d0..39c09e01b1 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, '../node_modules'), + path.resolve(sourceDir) + ] + }) themePath = path.dirname(themeLayoutPath) } catch (e) { throw new Error(`[vuepress] Failed to load custom theme "${