mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-19 16:01:24 +00:00
fix(kit): include declaration files when resolving compilerOptions.paths
This commit is contained in:
parent
7a2fbce01a
commit
835e89404f
@ -146,7 +146,7 @@ export async function updateTemplates (options?: { filter?: (template: ResolvedN
|
||||
return await tryUseNuxt()?.hooks.callHook('builder:generateApp', options)
|
||||
}
|
||||
|
||||
const EXTENSION_RE = /\b\.\w+$/g
|
||||
const EXTENSION_RE = /\b(?:\.d\.[cm]?ts|\.\w+)$/g
|
||||
// Exclude bridge alias types to support Volar
|
||||
const excludedAlias = [/^@vue\/.*$/, /^#internal\/nuxt/]
|
||||
export async function _generateTypes (nuxt: Nuxt) {
|
||||
@ -289,7 +289,11 @@ export async function _generateTypes (nuxt: Nuxt) {
|
||||
let absolutePath = resolve(basePath, aliases[alias]!)
|
||||
let stats = await fsp.stat(absolutePath).catch(() => null /* file does not exist */)
|
||||
if (!stats) {
|
||||
const resolvedModule = resolveModulePath(aliases[alias]!, { try: true, from: importPaths })
|
||||
const resolvedModule = resolveModulePath(aliases[alias]!, {
|
||||
try: true,
|
||||
from: importPaths,
|
||||
extensions: [...nuxt.options.extensions, '.d.ts', '.d.mts', '.d.cts'],
|
||||
})
|
||||
if (resolvedModule) {
|
||||
absolutePath = resolvedModule
|
||||
stats = await fsp.stat(resolvedModule).catch(() => null)
|
||||
|
Loading…
Reference in New Issue
Block a user