Skip to content
This repository was archived by the owner on Dec 1, 2019. It is now read-only.

Commit b43e2d8

Browse files
author
Stanislav Panferov
committed
fix(deps): fix path respolution for angular-style file names
1 parent 7dab184 commit b43e2d8

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/deps.ts

+5-7
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,11 @@ export class FileAnalyzer {
145145
resolve(resolver: IResolver, fileName: string, defPath: string): Promise<string> {
146146
let result;
147147

148-
if (!path.extname(defPath).length) {
148+
if (/^[a-z0-9].*\.d\.ts$/.test(defPath)) {
149+
// Make import relative
150+
defPath = './' + defPath;
151+
result = Promise.resolve(path.resolve(path.dirname(fileName), defPath));
152+
} else {
149153
result = resolver(path.dirname(fileName), defPath + ".ts")
150154
.error(function (error) {
151155
return resolver(path.dirname(fileName), defPath + ".d.ts")
@@ -165,12 +169,6 @@ export class FileAnalyzer {
165169
throw error;
166170
}
167171
})
168-
} else {
169-
if (/^[a-z0-9].*\.d\.ts$/.test(defPath)) {
170-
// Make import relative
171-
defPath = './' + defPath;
172-
}
173-
result = Promise.resolve(path.resolve(path.dirname(fileName), defPath));
174172
}
175173

176174
return result

0 commit comments

Comments
 (0)