dsherret / dsherret/ts-morph

.resolveSourceFileDependencies does not work as I would expect; no node_modules files

Open
#1,323 0 comments 4 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
6.2k
Forks
238
Avg merge
2m
Merged PRs (30d)
1

Description

I would expect that the following code (in a file named 'index.ts') would list not only that index.ts file,
but also all files that are included by the import statement (in this case the "ts-morph" import).
This is not the case. This code only lists that 1 index.ts file.
What do I need to do to get the files in node_modules listed?

```ts
import * as tm from "ts-morph"

const project = new tm.Project({
tsConfigFilePath: "./tsconfig.json"
})

const files = project.resolveSourceFileDependencies()

files.forEach(($) => {
console.log($.getFilePath())
})

project.getSourceFiles().forEach(($) => {
console.log(">", $.getFilePath())
})

Contributor guide

Open the contributing guide

Research direction

Start with index.ts, tsconfig.json, and the Project.resolveSourceFileDependencies() call shown in the issue. Run the example and inspect the resulting files alongside project.getSourceFiles(); done means the expected handling of the ts-morph import and node_modules files is established and the behavior or guidance matches that expectation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.