X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fdecache.ts;h=6be446ff64211455eec5c7ae291b3309821948a6;hb=07880c3642ca9fd9363850cf1a8e3cd2c6d9cd59;hp=e31973b7a61cb5b00b1c7c2c0bb729f1e1a7d8ac;hpb=c3edc5b074aa4bb1861ed0a94d3713808e87170f;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/decache.ts b/server/helpers/decache.ts index e31973b7a..6be446ff6 100644 --- a/server/helpers/decache.ts +++ b/server/helpers/decache.ts @@ -3,16 +3,16 @@ import { extname } from 'path' -function decachePlugin (pluginPath: string, libraryPath: string) { +function decachePlugin (libraryPath: string) { const moduleName = find(libraryPath) if (!moduleName) return searchCache(moduleName, function (mod) { delete require.cache[mod.id] - }) - removeCachedPath(pluginPath) + removeCachedPath(mod.path) + }) } function decacheModule (name: string) { @@ -22,9 +22,9 @@ function decacheModule (name: string) { searchCache(moduleName, function (mod) { delete require.cache[mod.id] - }) - removeCachedPath(moduleName) + removeCachedPath(mod.path) + }) } // --------------------------------------------------------------------------- @@ -68,7 +68,7 @@ function searchCache (moduleName: string, callback: (current: NodeModule) => voi }; function removeCachedPath (pluginPath: string) { - const pathCache = (module.constructor as any)._pathCache + const pathCache = (module.constructor as any)._pathCache as { [ id: string ]: string[] } Object.keys(pathCache).forEach(function (cacheKey) { if (cacheKey.includes(pluginPath)) {