[英]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? 有什么方法可以通过节点进程在需要的地方(带有require(“ ...”))来获取文件列表?
UPD, solution: module object itself contains links to all required children modules. UPD解决方案:模块对象本身包含指向所有必需子模块的链接。
The loaded modules are stored in require.cache object. 加载的模块存储在require.cache对象中。 You should be able to check that to see whats been loaded with require().
您应该能够检查以查看require()加载了什么。
http://nodejs.org/docs/latest/api/globals.html#require.cache http://nodejs.org/docs/latest/api/globals.html#require.cache
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.