Skip to content

Commit

Permalink
fix(core): failed to resolve theme components when using theme inheri…
Browse files Browse the repository at this point in the history
…tance (close: #3163) (#3164)
  • Loading branch information
ulivz authored Aug 14, 2023
1 parent 355e73a commit 546499b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/@vuepress/core/lib/node/theme-api/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const {
logger,
fs,
globby,
path: { resolve }
} = require('@vuepress/shared-utils')
const readdirSync = dir => (fs.existsSync(dir) && fs.readdirSync(dir)) || []

module.exports = class ThemeAPI {
constructor (theme, parentTheme) {
Expand Down Expand Up @@ -105,10 +105,12 @@ module.exports = class ThemeAPI {

function resolveSFCs (dirs) {
return dirs
.map(layoutDir =>
readdirSync(layoutDir)
.filter(filename => filename.endsWith('.vue'))
.map(filename => {
.map((layoutDir) =>
(fs.existsSync(layoutDir)
? globby.sync('**/*.vue', { cwd: layoutDir, absolute: false })
: []
)
.map((filename) => {
const componentName = getComponentName(filename)
return {
filename,
Expand Down

0 comments on commit 546499b

Please sign in to comment.