mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 07:32:01 +00:00
fix(kit): resolve alias for installModule
source
This commit is contained in:
parent
7ee7a7a7b5
commit
4bcb8fa791
@ -1,6 +1,7 @@
|
||||
import type { Nuxt } from '../types/nuxt'
|
||||
import type { LegacyNuxtModule, NuxtModule, ModuleMeta, ModuleInstallOptions, ModuleOptions, ModuleSrc } from '../types/module'
|
||||
import { requireModule } from '../utils/cjs'
|
||||
import { resolveModule, requireModule } from '../utils/cjs'
|
||||
import { resolveAlias } from '../utils/resolve'
|
||||
import { nuxtCtx } from '../nuxt'
|
||||
import { defineNuxtModule } from './define'
|
||||
import { ModuleContainer } from './container'
|
||||
@ -31,7 +32,8 @@ export async function installModule (nuxt: Nuxt, installOpts: ModuleInstallOptio
|
||||
// Resolve as legacy handler
|
||||
let handler: LegacyNuxtModule
|
||||
if (typeof src === 'string') {
|
||||
handler = requireModule(src)
|
||||
const _src = resolveModule(resolveAlias(src, nuxt.options.alias), { paths: nuxt.options.modulesDir })
|
||||
handler = requireModule(_src)
|
||||
if (!meta.name) {
|
||||
meta.name = src
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user