List of currently loaded node.js modules?

前端 未结 2 1598
长发绾君心
长发绾君心 2021-01-02 00:54

Is there a function in node.js that gives me all currently loaded modules - or even better, their filenames?

I want to restart my process as soon as a loaded module

2条回答
  •  迷失自我
    2021-01-02 01:23

    Check the module module source. Your answer is:

    Object.keys(require('module')._cache);
    

提交回复
热议问题