是否有黑客可以通过将更改传播到导入它的每个模块的方式来覆盖导出的类?我正在尝试覆盖从库中导出的方法。被覆盖的更改仅保留在对其进行覆盖的模块中。只是在寻找解决办法吗?
//Module A.js
import { ServerConnection } from '@jupyterlab/services';
ServerConnection.ContentsManager.overrideMethod = fnMyOverrideMethod;
//the above changes are only persisted with the module where it's overriden
//Module B.js
import { ServerConnection } from '@jupyterlab/services';
//ServerConnection.ContentsManager.overrideMethod will not point to the fnMyOverrideMethod