]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/decache.ts
Correctly unload plugin paths
[github/Chocobozzz/PeerTube.git] / server / helpers / decache.ts
index 08ab545e42aab664d479bdf87163467f98cbc74d..6be446ff64211455eec5c7ae291b3309821948a6 100644 (file)
@@ -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)
+  })
 }
 
 // ---------------------------------------------------------------------------