Skip to content

Commit

Permalink
Fix(Explore Config): Errors should not be caught
Browse files Browse the repository at this point in the history
  • Loading branch information
1aron committed Oct 31, 2023
1 parent 6c90fc5 commit 14edd8d
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions packages/explore-config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,21 @@ export default function exploreConfig(
}, options)
const { on, keys } = options
let foundConfig: any
try {
const foundPath = explorePathSync(source, options)
if (foundPath) {
const foundConfigModule = crossImport(path.resolve(options.cwd || '', foundPath))
for (const key of keys) {
foundConfig = foundConfigModule[key]
if (foundConfig) {
break
}
const foundPath = explorePathSync(source, options)
if (foundPath) {
const foundConfigModule = crossImport(path.resolve(options.cwd || '', foundPath))
for (const key of keys) {
foundConfig = foundConfigModule[key]
if (foundConfig) {
break
}
if (!foundConfig) {
foundConfig = foundConfigModule
}
on.found?.(foundPath)
} else {
on.notFound?.()
}
} catch (err) {
log.error(err)
if (!foundConfig) {
foundConfig = foundConfigModule
}
on.found?.(foundPath)
} else {
on.notFound?.()
}
return foundConfig
}

0 comments on commit 14edd8d

Please sign in to comment.