Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
verticalsync committed May 29, 2024
2 parents 9840829 + 9b9a532 commit 039fbdf
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 @@ -209,7 +209,7 @@ function patchFactories(factories: Record<string, (module: any, exports: any, re

// There are (at the time of writing) 11 modules exporting the window
// Make these non enumerable to improve webpack search performance
if (exports === window && require.c) {
if (require.c && (exports === window || exports?.default === window)) {
Object.defineProperty(require.c, id, {
value: require.c[id],
enumerable: false,
Expand All @@ -229,7 +229,7 @@ function patchFactories(factories: Record<string, (module: any, exports: any, re

for (const [filter, callback] of subscriptions) {
try {
if (filter(exports)) {
if (exports && filter(exports)) {
subscriptions.delete(filter);
callback(exports, id);
} else if (exports.default && filter(exports.default)) {
Expand Down
4 changes: 2 additions & 2 deletions src/webpack/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ export const find = traceFunction("find", function find(filter: FilterFn, { isIn

for (const key in cache) {
const mod = cache[key];
if (!mod?.exports || mod.exports === window) continue;
if (!mod?.exports) continue;

if (filter(mod.exports)) {
return isWaitFor ? [mod.exports, key] : mod.exports;
}

if (mod.exports.default && mod.exports.default !== window && filter(mod.exports.default)) {
if (mod.exports.default && filter(mod.exports.default)) {
const found = mod.exports.default;
return isWaitFor ? [found, key] : found;
}
Expand Down

0 comments on commit 039fbdf

Please sign in to comment.