I have an executable Node.js script (www) with a shebang (#!) which includes foo.js which in turn includes bar.js:
www:
#!/usr/bin/env node
const foo = require("./foo");
foo.js:
const bar = require("./bar");
bar.js
If I run the dependency-tree CLI on www, I get no dependencies:
$ npx dependency-tree -d . www | jq
{
"/Users/hiroshi/www": {}
}
If I rename www to www.js, I get the expected result
$ npx dependency-tree -d . www.js | jq
{
"/Users/hiroshi/www.js": {
"/Users/hiroshi/foo.js": {
"/Users/hiroshi/bar.js": {}
}
}
}
Environment:
$ npx dependency-tree --version
11.0.1
$ node --version
v18.20.4