dependents / dependents/node-dependency-tree

dependencyTree only returning an empty object

Open
#152 2 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
JavaScript
Stars
777
Forks
83
PR merge metrics
No merged PRs in 30d

Description

I'm hoping someone can help me understand how to use this, as I seem to be getting an empty object back when using `dependencyTree`.

I have files along the lines of:
```
.
└── src/
├── file1.js (doesnt depend on anything)
├── file2.js (depends on file1.js)
└── file3.js (depends on file1.js and file2.js)
```
Above, where I state that a file depends on another, it imports the other file with `require()`.

And I'm trying to get the dependency info like so:
```js
const srcFiles = await fs.readdir('./src/');
const trees = srcFiles.map(filename => dependencyTree({ filename, directory: './src' }));
console.log(trees);
```
Which outputs:
>[ {}, {}, {} ]

Obviously I'm expecting something other than an empty object for each file. If anyone can help me understand how to use this I'd appreciate it.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.