mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-10 15:13:02 -04:00
Improve webpack performance (~ 80ms -> 15ms)
This commit is contained in:
parent
0677df7818
commit
86c4bb7f8c
2 changed files with 29 additions and 4 deletions
|
@ -44,9 +44,15 @@ export function find(filter: FilterFn, getDefault = true) {
|
|||
|
||||
if (filter(mod.exports))
|
||||
return mod.exports;
|
||||
|
||||
if (typeof mod.exports !== "object") continue;
|
||||
|
||||
if (mod.exports.default && filter(mod.exports.default))
|
||||
return getDefault ? mod.exports.default : mod.exports;
|
||||
for (const nestedMod in mod.exports) {
|
||||
|
||||
// is 3 is the longest obfuscated export?
|
||||
// the length check makes search about 20% faster
|
||||
for (const nestedMod in mod.exports) if (nestedMod.length < 3) {
|
||||
const nested = mod.exports[nestedMod];
|
||||
if (nested && filter(nested)) return nested;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue