Compare commits

...

2 Commits

Author SHA1 Message Date
jay
47a944fe2a fix: 🐛 compat: don't use ?. for compat with older node.js 2020-12-24 09:19:32 +05:00
jay
1a3c345017 chore: 🙈 ignore .env 2020-12-24 09:16:11 +05:00
2 changed files with 3 additions and 2 deletions

1
.gitignore vendored
View File

@ -13,6 +13,7 @@
# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local

View File

@ -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]
}