From 07880c3642ca9fd9363850cf1a8e3cd2c6d9cd59 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 6 Jun 2023 11:59:27 +0200 Subject: Correctly unload plugin paths --- server/helpers/decache.ts | 10 +++++----- server/lib/plugins/plugin-manager.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'server') diff --git a/server/helpers/decache.ts b/server/helpers/decache.ts index 08ab545e4..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) + }) } // --------------------------------------------------------------------------- diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts index 9086a4c8e..88c5b60d7 100644 --- a/server/lib/plugins/plugin-manager.ts +++ b/server/lib/plugins/plugin-manager.ts @@ -496,7 +496,7 @@ export class PluginManager implements ServerHook { // Delete cache if needed const modulePath = join(pluginPath, packageJSON.library) - decachePlugin(pluginPath, modulePath) + decachePlugin(modulePath) const library: PluginLibrary = require(modulePath) if (!isLibraryCodeValid(library)) { -- cgit v1.2.3