Compare commits
2 Commits
de0af4d2ac
...
47a944fe2a
Author | SHA1 | Date | |
---|---|---|---|
|
47a944fe2a | ||
|
1a3c345017 |
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
# misc
|
# misc
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
.env
|
||||||
.env.local
|
.env.local
|
||||||
.env.development.local
|
.env.development.local
|
||||||
.env.test.local
|
.env.test.local
|
||||||
|
|
|
@ -29,7 +29,7 @@ let plugins = {}
|
||||||
function loadplugin(pluginname, pluginpath) {
|
function loadplugin(pluginname, pluginpath) {
|
||||||
try {
|
try {
|
||||||
plugins[pluginname] = require(pluginpath)
|
plugins[pluginname] = require(pluginpath)
|
||||||
plugins[pluginname]?.load(cfg)
|
plugins[pluginname].load(cfg)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.code == 'MODULE_NOT_FOUND') {
|
if (error.code == 'MODULE_NOT_FOUND') {
|
||||||
console.warn('plugin not used:', pluginpath)
|
console.warn('plugin not used:', pluginpath)
|
||||||
|
@ -44,7 +44,7 @@ function unloadplugin(pluginname, pluginpath) {
|
||||||
const plugin = require.resolve(pluginpath)
|
const plugin = require.resolve(pluginpath)
|
||||||
try {
|
try {
|
||||||
if (plugin && require.cache[plugin]) {
|
if (plugin && require.cache[plugin]) {
|
||||||
require.cache[plugin].exports?.unload()
|
require.cache[plugin].exports.unload()
|
||||||
delete plugins[pluginname]
|
delete plugins[pluginname]
|
||||||
delete require.cache[plugin]
|
delete require.cache[plugin]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user