Skip to content

Commit

Permalink
Merge pull request #32 from jupiter/master
Browse files Browse the repository at this point in the history
Fix "Maximum call stack size exceeded" in Node 8+
  • Loading branch information
nelsonic authored Oct 20, 2017
2 parents bf55a02 + 861cf1d commit eea4266
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions decache.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,20 @@ require.searchCache = function (moduleName, callback) {

// Check if the module has been resolved and found within
// the cache no else so #ignore else http://git.io/vtgMI
/* istanbul ignore else */
/* istanbul ignore else */
if (mod && ((mod = require.cache[mod]) !== undefined)) {
// Recursively go over the results
(function run(mod) {
// Go over each of the module's children and
// run over it
mod.children.forEach(function (child) {
run(child);
// Prevent infinite recursion
/* istanbul ignore next */
if (child.parent === mod) {
return;
} else {
run(child);
}
});

// Call the specified callback providing the
Expand Down

0 comments on commit eea4266

Please sign in to comment.