WHITECOLOR
WHITECOLOR

Reputation: 26192

Get all files required in node.js program

Is there some way to get list of files there where required (with require("...")) by node process?

UPD, solution: module object itself contains links to all required children modules.

Upvotes: 1

Views: 72

Answers (1)

Carol Skelly
Carol Skelly

Reputation: 362850

The loaded modules are stored in require.cache object. You should be able to check that to see whats been loaded with require().

http://nodejs.org/docs/latest/api/globals.html#require.cache

Upvotes: 1

Related Questions