Fix patchable modules

This commit is contained in:
Zack Rauen 2023-10-26 14:06:34 -04:00
parent 68688684a6
commit c985480fb9
2 changed files with 15 additions and 19 deletions

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
});
}
};
}]);
});
}
};

View File

@ -190,7 +190,7 @@ export default class WebpackModules {
if (!modules.hasOwnProperty(index)) continue;
let module = null;
try {module = modules[index]} catch {continue;};
try {module = modules[index];} catch {continue;}
const {exports} = module;
if (!exports || exports === window || exports === document.documentElement || exports[Symbol.toStringTag] === "DOMTokenList") continue;