perf(theme): improve findConfigPath (#246)

This commit is contained in:
pengzhanbo 2024-10-02 01:30:17 +08:00 committed by GitHub
parent 84c1ae39a1
commit 1444af6533
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View File

@ -20,11 +20,13 @@ export async function findConfigPath(app: App, configPath?: string): Promise<str
return path
}
}
extensions.forEach((ext) => {
paths.push(resolve(cwd, `./${CONFIG_FILE_NAME}.${ext}`))
paths.push(resolve(cwd, `${source}/${CONFIG_FILE_NAME}.${ext}`))
paths.push(resolve(cwd, `./.vuepress/${CONFIG_FILE_NAME}.${ext}`))
})
extensions.forEach(ext =>
paths.push(
resolve(cwd, `${source}/${CONFIG_FILE_NAME}.${ext}`),
resolve(cwd, `./${CONFIG_FILE_NAME}.${ext}`),
resolve(cwd, `./.vuepress/${CONFIG_FILE_NAME}.${ext}`),
),
)
let current: string | undefined
for (const path of paths) {
if (existsSync(path) && (await fsp.stat(path)).isFile()) {

View File

@ -38,7 +38,7 @@ export function getPlugins({
hostname,
cache,
}: SetupPluginOptions): PluginConfig {
const isProd = !app.env.isDev
const isProd = app.env.isBuild
const plugins: PluginConfig = [
markdownTitlePlugin(),