mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-16 18:07:02 -04:00
Fix canary crashing (#1833)
This commit is contained in:
parent
4a2def03e7
commit
1a1d9b07e8
9 changed files with 87 additions and 36 deletions
|
@ -36,9 +36,8 @@ if (window[WEBPACK_CHUNK]) {
|
|||
Object.defineProperty(window, WEBPACK_CHUNK, {
|
||||
get: () => webpackChunk,
|
||||
set: v => {
|
||||
if (v?.push !== Array.prototype.push) {
|
||||
if (v?.push !== Array.prototype.push && _initWebpack(v)) {
|
||||
logger.info(`Patching ${WEBPACK_CHUNK}.push`);
|
||||
_initWebpack(v);
|
||||
patchPush();
|
||||
// @ts-ignore
|
||||
delete window[WEBPACK_CHUNK];
|
||||
|
@ -85,10 +84,9 @@ function patchPush() {
|
|||
logger.error("Error in patched chunk", err);
|
||||
return void originalMod(module, exports, require);
|
||||
}
|
||||
|
||||
// There are (at the time of writing) 11 modules exporting the window
|
||||
// Make these non enumerable to improve webpack search performance
|
||||
if (module.exports === window) {
|
||||
if (exports === window) {
|
||||
Object.defineProperty(require.c, id, {
|
||||
value: require.c[id],
|
||||
enumerable: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue