plugins: less invasive cache cleanup

This commit is contained in:
Guillermo Rauch 2016-07-08 09:46:37 -07:00
parent 9960c239cd
commit 917c68c050

View file

@ -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];
}
}