I try to get the path information as follows:
const typeChecker = program.getTypeChecker()
const importFileSymbol = typeChecker.getSymbolAtLocation(
importDeclarationNode.moduleSpecifier
);
const path = importFileSymbol?.valueDeclaration?.path || '';
In this way, I can get the sourceFile object of the module source file, and get the absolute path of the module through the path…
Top comments (0)