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) {
searchCache(moduleName, function (mod) {
delete require.cache[mod.id]
- })
- removeCachedPath(moduleName)
+ removeCachedPath(mod.path)
+ })
}
// ---------------------------------------------------------------------------
// Delete cache if needed
const modulePath = join(pluginPath, packageJSON.library)
- decachePlugin(pluginPath, modulePath)
+ decachePlugin(modulePath)
const library: PluginLibrary = require(modulePath)
if (!isLibraryCodeValid(library)) {