From 917c68c0501efccbd4cc871a354ffeaa631acd41 Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Fri, 8 Jul 2016 09:46:37 -0700 Subject: [PATCH] plugins: less invasive cache cleanup --- plugins.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins.js b/plugins.js index 965f5343..d8761ec1 100644 --- a/plugins.js +++ b/plugins.js @@ -70,8 +70,7 @@ function updatePlugins ({ force = false } = {}) { paths = getPaths(plugins); // clear require cache - paths.plugins.forEach(clearCache); - paths.localPlugins.forEach(clearCache); + clearCache(); // cache modules modules = requirePlugins(); @@ -106,7 +105,7 @@ function getPluginVersions () { function clearCache (mod) { for (const entry in require.cache) { - if (0 === entry.indexOf(mod + '/')) { + if (entry.indexOf(path) === 0 || entry.indexOf(localPath) === 0) { delete require.cache[entry]; } }