Correctly unload plugin paths
This commit is contained in:
parent
25d7cc3cb6
commit
07880c3642
|
@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
@ -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)) {
|
||||
|
|
Loading…
Reference in New Issue