refactor: simplify config loading (#918)

pull/931/head
CHOYSEN 2 years ago committed by GitHub
parent bed68f1341
commit 4b9b385aff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -180,14 +180,9 @@ async function resolveUserConfig(
mode: string mode: string
): Promise<[UserConfig, string | undefined]> { ): Promise<[UserConfig, string | undefined]> {
// load user config // load user config
let configPath const configPath = supportedConfigExtensions
for (const ext of supportedConfigExtensions) { .map((ext) => resolve(root, `config.${ext}`))
const p = resolve(root, `config.${ext}`) .find(fs.pathExistsSync)
if (await fs.pathExists(p)) {
configPath = p
break
}
}
const userConfig: RawConfigExports = configPath const userConfig: RawConfigExports = configPath
? (( ? ((

Loading…
Cancel
Save