Skip to content

Commit 546499b

Browse files
authoredAug 14, 2023
fix(core): failed to resolve theme components when using theme inheritance (close: #3163) (#3164)
1 parent 355e73a commit 546499b

File tree

1 file changed

+7
-5
lines changed
  • packages/@vuepress/core/lib/node/theme-api

1 file changed

+7
-5
lines changed
 

‎packages/@vuepress/core/lib/node/theme-api/index.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
const {
22
logger,
33
fs,
4+
globby,
45
path: { resolve }
56
} = require('@vuepress/shared-utils')
6-
const readdirSync = dir => (fs.existsSync(dir) && fs.readdirSync(dir)) || []
77

88
module.exports = class ThemeAPI {
99
constructor (theme, parentTheme) {
@@ -105,10 +105,12 @@ module.exports = class ThemeAPI {
105105

106106
function resolveSFCs (dirs) {
107107
return dirs
108-
.map(layoutDir =>
109-
readdirSync(layoutDir)
110-
.filter(filename => filename.endsWith('.vue'))
111-
.map(filename => {
108+
.map((layoutDir) =>
109+
(fs.existsSync(layoutDir)
110+
? globby.sync('**/*.vue', { cwd: layoutDir, absolute: false })
111+
: []
112+
)
113+
.map((filename) => {
112114
const componentName = getComponentName(filename)
113115
return {
114116
filename,

0 commit comments

Comments
 (0)
Please sign in to comment.