Skip to content

Commit c4ceb64

Browse files
committed
fix: theme resolve
1 parent a0444df commit c4ceb64

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

packages/slidev/node/options.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { resolve, dirname } from 'path'
1+
import { resolve, dirname, join } from 'path'
22
import Vue from '@vitejs/plugin-vue'
33
import ViteIcons from 'vite-plugin-icons'
44
import ViteComponents from 'vite-plugin-components'
@@ -117,7 +117,7 @@ export async function resolveOptions(
117117
const roots = uniq([clientRoot, ...themeRoots, userRoot])
118118

119119
if (themeRoots.length) {
120-
const themeMeta = await getThemeMeta(theme, themeRoots[0])
120+
const themeMeta = await getThemeMeta(theme, join(themeRoots[0], 'package.json'))
121121
if (themeMeta)
122122
data.config = parser.resolveConfig(data.headmatter, themeMeta)
123123
}

packages/slidev/node/themes.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ export function packageExists(name: string) {
2222
return false
2323
}
2424

25-
export async function getThemeMeta(name: string, path?: string) {
26-
path ||= resolveImportPath(`${name}/package.json`)
25+
export async function getThemeMeta(name: string, path: string) {
26+
if (!fs.existsSync(path))
27+
return {}
2728

2829
if (path) {
2930
const { slidev = {}, engines = {} } = await fs.readJSON(path)

0 commit comments

Comments
 (0)