mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 07:40:33 +00:00
fix(kit): sort aliases before resolving (#7018)
This commit is contained in:
parent
af2835fa7f
commit
33d82b65ef
@ -2,6 +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 { tryUseNuxt, useNuxt } from './context'
|
||||
import { tryResolveModule } from './internal/cjs'
|
||||
import { isIgnored } from './ignore'
|
||||
@ -105,7 +106,7 @@ export function resolveAlias (path: string, alias?: Record<string, string>): str
|
||||
if (!alias) {
|
||||
alias = tryUseNuxt()?.options.alias || {}
|
||||
}
|
||||
for (const key in 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)
|
||||
|
Loading…
Reference in New Issue
Block a user