[英]Node.js get file name of the module from inside the module?
如何在加载过程中从模块内部获取Node.js模块的名称?
//mymodule.js
console.log(GET_MODULE_FULL_PATH_NAME())
//prog.js
require('/full/path/module')
OR
require('./module')
OR
require('module.js')
使用__filename
。 那会得到你想要的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.