Hotfix for Discord's switch to rspack (#1685)

* Fix patchable modules

* Fix bd-head location and modals
This commit is contained in:
2023-10-26 15:26:09 -04:00
parent e13b00e653
commit 0aff4fddee
4 changed files with 20 additions and 27 deletions
+14 -18
View File
@@ -34,24 +34,20 @@ export default function () {
if (!Reflect.has(window, chunkName)) {
predefine(window, chunkName, instance => {
predefine(instance, "push", () => {
instance.push([[Symbol()], {}, require => {
require.d = (target, exports) => {
for (const key in exports) {
if (!Reflect.has(exports, key) || target[key]) continue;
Object.defineProperty(target, key, {
get: () => exports[key](),
set: v => {exports[key] = () => v;},
enumerable: true,
configurable: true
});
}
};
}]);
instance.pop();
});
instance.push([[Symbol()], {}, require => {
require.d = (target, exports) => {
for (const key in exports) {
if (!Reflect.has(exports, key) || target[key]) continue;
Object.defineProperty(target, key, {
get: () => exports[key](),
set: v => {exports[key] = () => v;},
enumerable: true,
configurable: true
});
}
};
}]);
});
}
};