From ba29fc031a53a63a0acf3b7824f91cddff5d5d35 Mon Sep 17 00:00:00 2001 From: Inesh Bose Date: Tue, 19 Nov 2024 18:54:08 +0000 Subject: [PATCH] feat(kit): allow module defaults to be async --- packages/kit/src/module/define.ts | 2 +- packages/schema/src/types/module.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/kit/src/module/define.ts b/packages/kit/src/module/define.ts index 33ac6d015a..b0f30d80fb 100644 --- a/packages/kit/src/module/define.ts +++ b/packages/kit/src/module/define.ts @@ -65,7 +65,7 @@ function _defineNuxtModule< const optionsDefaults: TOptionsDefaults = module.defaults instanceof Function - ? module.defaults(nuxt) + ? await module.defaults(nuxt) : module.defaults ?? {} let options = defu(inlineOptions, nuxtConfigOptions, optionsDefaults) diff --git a/packages/schema/src/types/module.ts b/packages/schema/src/types/module.ts index 1879678923..532308f5a3 100644 --- a/packages/schema/src/types/module.ts +++ b/packages/schema/src/types/module.ts @@ -64,7 +64,7 @@ export interface ModuleDefinition< TWith extends boolean, > { meta?: ModuleMeta - defaults?: TOptionsDefaults | ((nuxt: Nuxt) => TOptionsDefaults) + defaults?: TOptionsDefaults | ((nuxt: Nuxt) => Awaitable) schema?: TOptions hooks?: Partial setup?: (