diff --git a/packages/kit/src/resolve.ts b/packages/kit/src/resolve.ts index b6b051b825..8de9f214e5 100644 --- a/packages/kit/src/resolve.ts +++ b/packages/kit/src/resolve.ts @@ -85,9 +85,9 @@ function existsSyncSensitive (path: string, files?: string[]) { */ export function resolveAlias (path: string, alias: ResolveOptions['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)) { - path = alias[key] + path.substr(key.length) + path = alias[key] + path.slice(key.length) } } return path