fix: 🐛 compat: don't use ?.
for compat with older node.js
This commit is contained in:
parent
1a3c345017
commit
47a944fe2a
|
@ -29,7 +29,7 @@ let plugins = {}
|
|||
function loadplugin(pluginname, pluginpath) {
|
||||
try {
|
||||
plugins[pluginname] = require(pluginpath)
|
||||
plugins[pluginname]?.load(cfg)
|
||||
plugins[pluginname].load(cfg)
|
||||
} catch (error) {
|
||||
if (error.code == 'MODULE_NOT_FOUND') {
|
||||
console.warn('plugin not used:', pluginpath)
|
||||
|
@ -44,7 +44,7 @@ function unloadplugin(pluginname, pluginpath) {
|
|||
const plugin = require.resolve(pluginpath)
|
||||
try {
|
||||
if (plugin && require.cache[plugin]) {
|
||||
require.cache[plugin].exports?.unload()
|
||||
require.cache[plugin].exports.unload()
|
||||
delete plugins[pluginname]
|
||||
delete require.cache[plugin]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user