Created
August 13, 2015 23:25
-
-
Save davideicardi/10c4aeacc433586dd140 to your computer and use it in GitHub Desktop.
Clean up node js require cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cleanRequireCache(){ | |
Object.keys(require.cache).forEach(function(key) { | |
delete require.cache[key]; | |
}); | |
} | |
function cleanRequire(path){ | |
delete require.cache[require.resolve(path)]; | |
return require(path); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment