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

Commit a23d4bf

Browse files
author
Stanislav Panferov
committed
fix(deps): don't resolve symlinks to all .d.ts files
1 parent f2b948c commit a23d4bf

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/deps.ts

+7-8
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,14 @@ export class FileAnalyzer {
148148
if (/^[a-z0-9].*\.d\.ts$/.test(defPath)) {
149149
// Make import relative
150150
defPath = './' + defPath;
151+
}
152+
153+
if (isTypeDeclaration(defPath)) {
154+
// We MUST NOT resolve symlinks when working with .d.ts files, because/
155+
// they work whithout module resolution.
151156
result = Promise.resolve(path.resolve(path.dirname(fileName), defPath));
152157
} else {
153-
result = resolver(path.dirname(fileName), defPath + ".ts")
154-
.error(function (error) {
155-
return resolver(path.dirname(fileName), defPath + ".d.ts")
156-
})
157-
.error(function (error) {
158-
return resolver(path.dirname(fileName), defPath)
159-
})
158+
result = resolver(path.dirname(fileName), defPath)
160159
.error(function (error) {
161160
// Node builtin modules
162161
try {
@@ -168,7 +167,7 @@ export class FileAnalyzer {
168167
} catch (e) {
169168
throw error;
170169
}
171-
})
170+
});
172171
}
173172

174173
return result

0 commit comments

Comments
 (0)