react-native-bundle-splitter icon indicating copy to clipboard operation
react-native-bundle-splitter copied to clipboard

TypeError: Cannot read property "require" of undefined

Open RZulfikri opened this issue 3 years ago • 2 comments

Hi I found an issue that spam our sentry and development screens. After few testing on this liblary I found that mapLoadable[name] can be undefined. So when you extract with const {require, loader, ...} = mapLoadable[name] it will trow an error.

https://github.com/kirillzyusko/react-native-bundle-splitter/blob/c44c7bd3ba24d76d23a0afcb52ff366a2593c545/src/map.ts#L31

I'm trying to fix this by adding condition on top of that code, by cheking mapLoadable[name] exist, before extract the value.

RZulfikri avatar Feb 22 '23 18:02 RZulfikri

here is the error that I found, cc @kirillzyusko

Simulator Screen Shot - iPhone 14 Pro Max - 2023-02-23 at 00 59 28

RZulfikri avatar Feb 24 '23 08:02 RZulfikri

Hi @RZulfikri

Thanks for submitting a PR!

Could you please say, how it's possible to call getComponent when it hasn't been registered yet? 🤔 I think something is wrong with the code of your app...

Would be great if you could provide a minimal reproduction example of the issue 😊

kirillzyusko avatar Feb 24 '23 10:02 kirillzyusko