Skip to content

Commit

Permalink
try to use config.default before using config
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinMalfait committed Mar 29, 2023
1 parent 14d5a0a commit 2b3b7dd
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/lib/load-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ function lazyJiti() {
}

export function loadConfig(path: string): Config {
try {
return path ? require(path) : {}
} catch {
return lazyJiti()(path)
}
let config = (function () {
try {
return path ? require(path) : {}
} catch {
return lazyJiti()(path)
}
})()

return config.default ?? config
}

0 comments on commit 2b3b7dd

Please sign in to comment.