Skip to content

Commit

Permalink
Handle alias with absolute path
Browse files Browse the repository at this point in the history
  • Loading branch information
simonihmig committed Oct 7, 2024
1 parent 81ff92e commit ac316b3
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions packages/ember-auto-import/ts/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,27 @@ export default class Package {
// relative or absolute path, rather than a package name. If the
// originally authored import was an absolute or relative path, it would
// have hit our { type: 'local' } condition before we ran aliasFor.
//
// At the moment, we don't try to handle this case, but we could in the
// future.

packageName = getPackageName(importedPath);

if (packageName) {
let packageRoot: string | undefined;
let packagePath = resolvePackagePath(packageName, this.root);

if (packagePath) {
packageRoot = dirname(packagePath);
}

if (packageRoot) {
return {
type: 'package',
path,
packageName,
packageRoot,
};
}
}

return {
type: 'local',
local: path,
Expand Down

0 comments on commit ac316b3

Please sign in to comment.