Skip to content

Commit

Permalink
perf(theme): improve findConfigPath (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
pengzhanbo authored Oct 1, 2024
1 parent 84c1ae3 commit 1444af6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions theme/src/node/loadConfig/findConfigPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
2 changes: 1 addition & 1 deletion theme/src/node/plugins/getPlugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 1444af6

Please sign in to comment.