Skip to content

Instantly share code, notes, and snippets.

@adamkiss
Created March 31, 2017 20:57
Show Gist options
  • Save adamkiss/c82fd46a87c2169312231c638c997e50 to your computer and use it in GitHub Desktop.
Save adamkiss/c82fd46a87c2169312231c638c997e50 to your computer and use it in GitHub Desktop.
Require fresh module each time (as a function in lib.js)
'use strict'
module.exports = {
require_fresh: function (file) {
delete require.cache[require.resolve(file)]
return require(file)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment