Skip to content

Commit

Permalink
webpack: ignore window in findAll and waitFor
Browse files Browse the repository at this point in the history
  • Loading branch information
Vendicated committed May 29, 2024
1 parent da01237 commit 24b67cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/webpack/patchWebpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,10 @@ function patchFactories(factories: Record<string, (module: any, exports: any, re

for (const [filter, callback] of subscriptions) {
try {
if (filter(exports)) {
if (exports && exports !== window && filter(exports)) {
subscriptions.delete(filter);
callback(exports, id);
} else if (exports.default && filter(exports.default)) {
} else if (exports.default && exports.default !== window && filter(exports.default)) {
subscriptions.delete(filter);
callback(exports.default, id);
}
Expand Down
4 changes: 2 additions & 2 deletions src/webpack/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ export function findAll(filter: FilterFn) {
const ret = [] as any[];
for (const key in cache) {
const mod = cache[key];
if (!mod?.exports) continue;
if (!mod?.exports || mod.exports === window) continue;

if (filter(mod.exports))
ret.push(mod.exports);

if (mod.exports.default && filter(mod.exports.default))
if (mod.exports.default && mod.exports.default !== window && filter(mod.exports.default))
ret.push(mod.exports.default);
}

Expand Down

0 comments on commit 24b67cf

Please sign in to comment.