dns-witch.net.eu.org/node_modules/@11ty/dependency-tree-esm
2025-07-05 18:19:59 +02:00
..
.github/workflows 11ty + RIP DNS Witch EU.ORG service 2025-07-05 18:19:59 +02:00
test 11ty + RIP DNS Witch EU.ORG service 2025-07-05 18:19:59 +02:00
LICENSE 11ty + RIP DNS Witch EU.ORG service 2025-07-05 18:19:59 +02:00
main.js 11ty + RIP DNS Witch EU.ORG service 2025-07-05 18:19:59 +02:00
package.json 11ty + RIP DNS Witch EU.ORG service 2025-07-05 18:19:59 +02:00
README.md 11ty + RIP DNS Witch EU.ORG service 2025-07-05 18:19:59 +02:00

dependency-tree-esm

Returns an unordered array of local paths to dependencies of a Node ES module JavaScript file.

This is used by Eleventy to find dependencies of a JavaScript file to watch for changes to re-run Eleventys build.

Installation

npm install --save-dev @11ty/dependency-tree-esm

Features

  • Ignores bare specifiers (e.g. import "my-package")
  • Ignores Nodes built-ins (e.g. import "path")
  • Handles circular dependencies
  • Returns an empty set if the file does not exist.

Usage

// my-file.js

// if my-local-dependency.js has dependencies, it will include those too
import "./my-local-dependency.js";


// ignored, is a built-in
import path from "path";
const { find } = require("@11ty/dependency-tree-esm");

await find("./my-file.js");
// returns ["./my-local-dependency.js"]