ts-morph
ts-morph copied to clipboard
Q: How do I navigate source files from a dependency?
I might be doing things totally wrong but I am using ts-morph to generate a TS file at build time. I want to navigate all the source files within a particular dependency using the normal module resolution algorithm. My package is one of many workspaces and so hard coding the path to ./node_modules/foo/ is not a great idea. This seems like it should be possible but I'm not seeing it. How can this be done? Thanks in advance.
const sourceFile = importDeclaration.getModuleSpecifierSourceFile();
Relevant docs here: https://ts-morph.com/details/imports