Skip to content

Commit

Permalink
feat(core): support async functions within unlighthouse.config.ts
Browse files Browse the repository at this point in the history
Fixes #248
  • Loading branch information
harlan-zw committed Jan 1, 2025
1 parent a3ee8f0 commit a4cf53b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/core/src/unlighthouse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ export async function createUnlighthouse(userConfig: UserConfig, provider?: Prov
if (configDefinition.sources?.[0]) {
configFile = configDefinition.sources[0]
// @ts-expect-error fixes issue with default being returned for mjs loads
const config = configDefinition.config?.default || configDefinition.config
userConfig = defu(config, userConfig)
let config = configDefinition.config?.default || configDefinition.config
if (typeof config === 'function') {
config = await config()
}
userConfig = defu(config || {}, userConfig)
}
const runtimeSettings: { moduleWorkingDir: string, lighthouseProcessPath: string } & Partial<RuntimeSettings> = {
configFile: configFile || undefined,
Expand Down

0 comments on commit a4cf53b

Please sign in to comment.