Add warning when using the 'modifyClass' plugin API after it's been cached in the container
This commit is contained in:
parent
5324c9817f
commit
15fa27a1ff
|
@ -55,6 +55,10 @@ class PluginApi {
|
||||||
* ```
|
* ```
|
||||||
**/
|
**/
|
||||||
modifyClass(resolverName, changes) {
|
modifyClass(resolverName, changes) {
|
||||||
|
if (this.container.cache[resolverName]) {
|
||||||
|
console.warn(`"${resolverName}" was already cached in the container. Changes won't be applied.`);
|
||||||
|
}
|
||||||
|
|
||||||
const klass = this.container.factoryFor(resolverName);
|
const klass = this.container.factoryFor(resolverName);
|
||||||
klass.class.reopen(changes);
|
klass.class.reopen(changes);
|
||||||
return klass;
|
return klass;
|
||||||
|
|
Loading…
Reference in New Issue