We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bb0068a commit c77b0fcCopy full SHA for c77b0fc
src/lib/utils/plugins.ts
@@ -42,11 +42,15 @@ export class PluginHost extends AbstractComponent<Application> {
42
const plugin = plugins[i];
43
try {
44
const instance = require(plugin);
45
- if (typeof instance === 'function') {
+ const initFunction = typeof instance.load === 'function'
46
+ ? instance.load
47
+ : instance // support legacy plugins
48
+ ;
49
+ if (typeof initFunction === 'function') {
50
instance(this);
51
logger.write('Loaded plugin %s', plugin);
52
} else {
- logger.error('The plugin %s did not return a function.', plugin);
53
+ logger.error('Invalid structure in plugin %s, no function found.', plugin);
54
}
55
} catch (error) {
56
logger.error('The plugin %s could not be loaded.', plugin);
0 commit comments