Skip to content

Commit

Permalink
Add fix for native re-requires (tschaub#178).
Browse files Browse the repository at this point in the history
  • Loading branch information
rosston committed Nov 1, 2016
1 parent 86805d7 commit d7852e5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
* again after this one.
*/
Object.keys(require.cache).forEach(function(key) {
if (key.indexOf(__dirname) === -1) {
var nativeSuffix = '.node';
var isNative = key.indexOf(nativeSuffix, key.length - nativeSuffix.length) !== -1;
if (key.indexOf(__dirname) === -1 && !isNative) {
delete require.cache[key];
}
});
Expand Down

0 comments on commit d7852e5

Please sign in to comment.