Skip to content

Instantly share code, notes, and snippets.

@davideicardi
Created August 13, 2015 23:25
Show Gist options
  • Save davideicardi/10c4aeacc433586dd140 to your computer and use it in GitHub Desktop.
Save davideicardi/10c4aeacc433586dd140 to your computer and use it in GitHub Desktop.
Clean up node js require cache
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