Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
fix(kit): normalize (sort) aliases before resolving
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Aug 29, 2022
1 parent 25ef26c commit 022a084
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/kit/src/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 022a084

Please sign in to comment.