feat(kit): allow module default options to be async (#29980)

This commit is contained in:
Inesh Bose 2024-11-26 14:09:04 +00:00 committed by GitHub
parent a8d5cb7a33
commit 7e72e06603
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -65,7 +65,7 @@ function _defineNuxtModule<
const optionsDefaults: TOptionsDefaults =
module.defaults instanceof Function
? module.defaults(nuxt)
? await module.defaults(nuxt)
: module.defaults ?? <TOptionsDefaults> {}
let options = defu(inlineOptions, nuxtConfigOptions, optionsDefaults)

View File

@ -64,7 +64,7 @@ export interface ModuleDefinition<
TWith extends boolean,
> {
meta?: ModuleMeta
defaults?: TOptionsDefaults | ((nuxt: Nuxt) => TOptionsDefaults)
defaults?: TOptionsDefaults | ((nuxt: Nuxt) => Awaitable<TOptionsDefaults>)
schema?: TOptions
hooks?: Partial<NuxtHooks>
setup?: (