feat(lib/modules/metro): blacklist primitives and empty objects for finders
This commit is contained in:
parent
c66dace21b
commit
f05885e559
1 changed files with 10 additions and 1 deletions
|
|
@ -106,7 +106,16 @@ function handleFactoryCall(
|
|||
)
|
||||
|
||||
const { exports } = moduleObject
|
||||
if (exports != null) mInitialized.add(mInitializingId)
|
||||
|
||||
// Blacklist exports that:
|
||||
// - are primitives (https://developer.mozilla.org/en-US/docs/Glossary/Primitive)
|
||||
// - are empty objects
|
||||
if (exports instanceof Object) {
|
||||
if (exports.__proto__ === Object.prototype) {
|
||||
if (Reflect.ownKeys(exports).length)
|
||||
mInitialized.add(mInitializingId!)
|
||||
} else mInitialized.add(mInitializingId)
|
||||
}
|
||||
|
||||
executeInitializeSubscriptions(mInitializingId, exports)
|
||||
} finally {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue