mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-29 17:07:22 +00:00
fix(kit): avoid adding already installed modules to internal _installedModules
(#18647)
This commit is contained in:
parent
d1a79a95a6
commit
637b88304e
@ -41,8 +41,7 @@ export function defineNuxtModule<OptionsT extends ModuleOptions> (definition: Mo
|
||||
if (uniqueKey) {
|
||||
nuxt.options._requiredModules = nuxt.options._requiredModules || {}
|
||||
if (nuxt.options._requiredModules[uniqueKey]) {
|
||||
// TODO: Notify user if inline options is provided since will be ignored!
|
||||
return
|
||||
return false
|
||||
}
|
||||
nuxt.options._requiredModules[uniqueKey] = true
|
||||
}
|
||||
|
@ -9,7 +9,10 @@ export async function installModule (moduleToInstall: string | NuxtModule, _inli
|
||||
const { nuxtModule, inlineOptions } = await normalizeModule(moduleToInstall, _inlineOptions)
|
||||
|
||||
// Call module
|
||||
await nuxtModule(inlineOptions, nuxt)
|
||||
const res = await nuxtModule(inlineOptions, nuxt)
|
||||
if (res === false /* setup aborted */) {
|
||||
return
|
||||
}
|
||||
|
||||
if (typeof moduleToInstall === 'string') {
|
||||
nuxt.options.build.transpile.push(moduleToInstall)
|
||||
|
@ -36,8 +36,9 @@ export interface ModuleDefinition<T extends ModuleOptions = ModuleOptions> {
|
||||
}
|
||||
|
||||
/** Nuxt modules are always a simple function. */
|
||||
type Awaitable<T> = T | Promise<T>
|
||||
export interface NuxtModule<T extends ModuleOptions = ModuleOptions> {
|
||||
(this: void, inlineOptions: T, nuxt: Nuxt): void | Promise<void>
|
||||
(this: void, inlineOptions: T, nuxt: Nuxt): Awaitable<void | false>
|
||||
getOptions?: (inlineOptions?: T, nuxt?: Nuxt) => Promise<T>
|
||||
getMeta?: () => Promise<ModuleMeta>
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user