Let say, after I require a module and do something as below:
var b = require(\'./b.js\'); --- do something with b ---
Then I want to take a
You can use this to delete its entry in the cache:
delete require.cache[require.resolve('./b.js')]
require.resolve() will figure out the full path of ./b.js, which is used as a cache key.
require.resolve()
./b.js