mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-20 00:11:18 +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)
|
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
|
// Exclude bridge alias types to support Volar
|
||||||
const excludedAlias = [/^@vue\/.*$/, /^#internal\/nuxt/]
|
const excludedAlias = [/^@vue\/.*$/, /^#internal\/nuxt/]
|
||||||
export async function _generateTypes (nuxt: Nuxt) {
|
export async function _generateTypes (nuxt: Nuxt) {
|
||||||
@ -289,7 +289,11 @@ export async function _generateTypes (nuxt: Nuxt) {
|
|||||||
let absolutePath = resolve(basePath, aliases[alias]!)
|
let absolutePath = resolve(basePath, aliases[alias]!)
|
||||||
let stats = await fsp.stat(absolutePath).catch(() => null /* file does not exist */)
|
let stats = await fsp.stat(absolutePath).catch(() => null /* file does not exist */)
|
||||||
if (!stats) {
|
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) {
|
if (resolvedModule) {
|
||||||
absolutePath = resolvedModule
|
absolutePath = resolvedModule
|
||||||
stats = await fsp.stat(resolvedModule).catch(() => null)
|
stats = await fsp.stat(resolvedModule).catch(() => null)
|
||||||
|
Loading…
Reference in New Issue
Block a user