Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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