Skip to content

No dependencies shown for executable Node.js script w/o any filename extension #181

Open
@hiroshi-ishii

Description

@hiroshi-ishii

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

// empty

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions