fix(kit): don't ignore @ alias (#2737)

This commit is contained in:
Daniel Roe 2022-01-17 12:51:08 +00:00 committed by GitHub
parent 91032cdd64
commit 0ed2d4a00b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -85,9 +85,9 @@ function existsSyncSensitive (path: string, files?: string[]) {
*/ */
export function resolveAlias (path: string, alias: ResolveOptions['alias']) { export function resolveAlias (path: string, alias: ResolveOptions['alias']) {
for (const key in alias) { for (const key in alias) {
if (key === '@') { continue } // Don't resolve @foo/bar if (key === '@' && !path.startsWith('@/')) { continue } // Don't resolve @foo/bar
if (path.startsWith(key)) { if (path.startsWith(key)) {
path = alias[key] + path.substr(key.length) path = alias[key] + path.slice(key.length)
} }
} }
return path return path