fix: bug (#2797)
This commit is contained in:
parent
3793bb6cb7
commit
af32a4e59a
@ -73,11 +73,11 @@ export class PluginManager {
|
|||||||
|
|
||||||
get<T extends typeof Plugin>(PluginClass: T): InstanceType<T>;
|
get<T extends typeof Plugin>(PluginClass: T): InstanceType<T>;
|
||||||
get<T extends {}>(name: string): T;
|
get<T extends {}>(name: string): T;
|
||||||
get(name: any) {
|
get(nameOrPluginClass: any) {
|
||||||
if (typeof name === 'string') {
|
if (typeof nameOrPluginClass === 'string') {
|
||||||
return this.pluginsAliases[name];
|
return this.pluginsAliases[nameOrPluginClass];
|
||||||
}
|
}
|
||||||
return this.pluginInstances.get(name);
|
return this.pluginInstances.get(nameOrPluginClass.default || nameOrPluginClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getInstance<T>(plugin: typeof Plugin, opts?: T) {
|
private getInstance<T>(plugin: typeof Plugin, opts?: T) {
|
||||||
|
@ -15,7 +15,7 @@ export function definePluginClient(packageName: string) {
|
|||||||
value: true,
|
value: true,
|
||||||
});
|
});
|
||||||
Object.keys(_plugin).forEach(function (key) {
|
Object.keys(_plugin).forEach(function (key) {
|
||||||
if (key === 'default' || key === '__esModule') return;
|
if (key === '__esModule') return;
|
||||||
if (key in _exports && _exports[key] === _plugin[key]) return;
|
if (key in _exports && _exports[key] === _plugin[key]) return;
|
||||||
Object.defineProperty(_exports, key, {
|
Object.defineProperty(_exports, key, {
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user