ts-morph icon indicating copy to clipboard operation
ts-morph copied to clipboard

Is it possible to resolve node_modules?

Open dherault opened this issue 9 months ago • 1 comments

Hi,

I have a project where I need to determine whether the module fs is imported into a codebase. This must include the node_modules too. So far I've been using addSourceFileAtPath with the codebase's entry and the dependencies resolved entries.

But as far as I can tell resolveSourceFileDependencies does not resolve the node_modules' imports.

Do you know how I can resolve the full codebase?

dherault avatar Feb 24 '25 09:02 dherault

I think project.getAmbientModule("fs") or project.getAmbientModule("node:fs") https://github.com/dsherret/ts-morph/blob/a1c61c7e04928de5d8fc12f32a76e3ed5b7ffea1/packages/ts-morph/lib/ts-morph.d.ts#L644

dsherret avatar Feb 24 '25 14:02 dsherret