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

Commit dacee2d

Browse files
committed
fix: search all nodes for modules (can be optimized)
1 parent d439bcc commit dacee2d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/deps.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export class FileAnalyzer {
7474

7575
findImportDeclarations(fileName: string): ts.ResolvedModule[] {
7676
let sourceFile = this.state.getSourceFile(fileName);
77+
let ts = this.state.ts;
7778

7879
let imports = [];
7980
let visit = (node: ts.Node) => {
@@ -85,11 +86,12 @@ export class FileAnalyzer {
8586
let importPath = (<any>node).moduleSpecifier.text;
8687
imports.push(importPath);
8788
}
89+
90+
ts.forEachChild(node, visit);
8891
};
8992

9093
imports.push.apply(imports, sourceFile.referencedFiles.map(file => file.fileName));
91-
92-
this.state.ts.forEachChild(sourceFile, visit);
94+
ts.forEachChild(sourceFile, visit);
9395

9496
let resolvedImports = imports.map((importPath) => {
9597
return this.resolve(fileName, importPath);

0 commit comments

Comments
 (0)