mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 23:22:02 +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) {
|
if (uniqueKey) {
|
||||||
nuxt.options._requiredModules = nuxt.options._requiredModules || {}
|
nuxt.options._requiredModules = nuxt.options._requiredModules || {}
|
||||||
if (nuxt.options._requiredModules[uniqueKey]) {
|
if (nuxt.options._requiredModules[uniqueKey]) {
|
||||||
// TODO: Notify user if inline options is provided since will be ignored!
|
return false
|
||||||
return
|
|
||||||
}
|
}
|
||||||
nuxt.options._requiredModules[uniqueKey] = true
|
nuxt.options._requiredModules[uniqueKey] = true
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,10 @@ export async function installModule (moduleToInstall: string | NuxtModule, _inli
|
|||||||
const { nuxtModule, inlineOptions } = await normalizeModule(moduleToInstall, _inlineOptions)
|
const { nuxtModule, inlineOptions } = await normalizeModule(moduleToInstall, _inlineOptions)
|
||||||
|
|
||||||
// Call module
|
// Call module
|
||||||
await nuxtModule(inlineOptions, nuxt)
|
const res = await nuxtModule(inlineOptions, nuxt)
|
||||||
|
if (res === false /* setup aborted */) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof moduleToInstall === 'string') {
|
if (typeof moduleToInstall === 'string') {
|
||||||
nuxt.options.build.transpile.push(moduleToInstall)
|
nuxt.options.build.transpile.push(moduleToInstall)
|
||||||
|
@ -36,8 +36,9 @@ export interface ModuleDefinition<T extends ModuleOptions = ModuleOptions> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Nuxt modules are always a simple function. */
|
/** Nuxt modules are always a simple function. */
|
||||||
|
type Awaitable<T> = T | Promise<T>
|
||||||
export interface NuxtModule<T extends ModuleOptions = ModuleOptions> {
|
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>
|
getOptions?: (inlineOptions?: T, nuxt?: Nuxt) => Promise<T>
|
||||||
getMeta?: () => Promise<ModuleMeta>
|
getMeta?: () => Promise<ModuleMeta>
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user