Skip to content

Commit 432e662

Browse files
committed
refactor: log error when theme cannot be resolved
1 parent 26ab8fc commit 432e662

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/@vuepress/core/lib/prepare/loadTheme.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ module.exports = async function loadTheme (ctx) {
4848
themePath = localThemePath
4949
logger.tip(`\nApply theme located at ${chalk.gray(themePath)}...`)
5050
} else if (isString(theme)) {
51-
const { entry: modulePath, name, shortcut } = themeResolver.resolve(theme, sourceDir)
52-
51+
const resolved = themeResolver.resolve(theme, sourceDir)
52+
const { entry: modulePath, name, shortcut } = resolved
53+
if (modulePath === null) {
54+
throw new Error(`Cannot resolve theme ${theme}.`)
55+
}
5356
if (modulePath.endsWith('.js') || modulePath.endsWith('.vue')) {
5457
themePath = path.parse(modulePath).dir
5558
} else {

0 commit comments

Comments
 (0)