mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(kit): use pathe
to resolve aliases (#8453)
This commit is contained in:
parent
59d8c51b5b
commit
54da6f81a0
@ -2,7 +2,7 @@ import { promises as fsp, existsSync } from 'node:fs'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { basename, dirname, resolve, join, normalize, isAbsolute } from 'pathe'
|
||||
import { globby } from 'globby'
|
||||
import { normalizeAliases } from 'pathe/utils'
|
||||
import { resolveAlias as _resolveAlias } from 'pathe/utils'
|
||||
import { tryUseNuxt, useNuxt } from './context'
|
||||
import { tryResolveModule } from './internal/cjs'
|
||||
import { isIgnored } from './ignore'
|
||||
@ -106,13 +106,7 @@ export function resolveAlias (path: string, alias?: Record<string, string>): str
|
||||
if (!alias) {
|
||||
alias = tryUseNuxt()?.options.alias || {}
|
||||
}
|
||||
for (const key in normalizeAliases(alias)) {
|
||||
if (key === '@' && !path.startsWith('@/')) { continue } // Don't resolve @foo/bar
|
||||
if (path.startsWith(key)) {
|
||||
path = alias[key] + path.slice(key.length)
|
||||
}
|
||||
}
|
||||
return path
|
||||
return _resolveAlias(path, alias)
|
||||
}
|
||||
|
||||
export interface Resolver {
|
||||
|
Loading…
Reference in New Issue
Block a user