diff --git a/index.js b/index.js index ce1e224..197f151 100644 --- a/index.js +++ b/index.js @@ -61,7 +61,10 @@ function getDependencies(mod, result, visited, depth) { var dependencies = mod.dependencies || [] Object.keys(dependencies).forEach(name => { var dep = mod.dependencies[name] - if (dep === mod) return + if (dep === mod) { + delete mod.dependencies[name] + return + } if (typeof dep === 'string') return if (visited[dep.realPath]) return visited[dep.realPath] = true diff --git a/installed.js b/installed.js index 156f8b2..5d22dfb 100644 --- a/installed.js +++ b/installed.js @@ -95,7 +95,10 @@ function getDependencies(mod, result, visited, depth) { var dependencies = mod.dependencies || []; Object.keys(dependencies).forEach(function (name) { var dep = mod.dependencies[name]; - if (dep === mod) return; + if (dep === mod) { + delete mod.dependencies[name]; + return; + } if (typeof dep === "string") return; if (visited[dep.realPath]) return; visited[dep.realPath] = true;