Last active
February 14, 2023 00:44
-
-
Save insomniac-xt/00b8400fb7cb875bb973 to your computer and use it in GitHub Desktop.
Node.js require force reload
This file contains hidden or 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
var requireReload = function(modulePath){ | |
delete require.cache[require.resolve(modulePath)]; | |
return require(modulePath); | |
}; |
function cleanCache () {
Object.keys(require.cache).forEach(function (key) { delete require.cache[key] })
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thx random ppl on the internet