mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
plugins: less invasive cache cleanup
This commit is contained in:
parent
9960c239cd
commit
917c68c050
1 changed files with 2 additions and 3 deletions
|
|
@ -70,8 +70,7 @@ function updatePlugins ({ force = false } = {}) {
|
||||||
paths = getPaths(plugins);
|
paths = getPaths(plugins);
|
||||||
|
|
||||||
// clear require cache
|
// clear require cache
|
||||||
paths.plugins.forEach(clearCache);
|
clearCache();
|
||||||
paths.localPlugins.forEach(clearCache);
|
|
||||||
|
|
||||||
// cache modules
|
// cache modules
|
||||||
modules = requirePlugins();
|
modules = requirePlugins();
|
||||||
|
|
@ -106,7 +105,7 @@ function getPluginVersions () {
|
||||||
|
|
||||||
function clearCache (mod) {
|
function clearCache (mod) {
|
||||||
for (const entry in require.cache) {
|
for (const entry in require.cache) {
|
||||||
if (0 === entry.indexOf(mod + '/')) {
|
if (entry.indexOf(path) === 0 || entry.indexOf(localPath) === 0) {
|
||||||
delete require.cache[entry];
|
delete require.cache[entry];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue