Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[expo] Send a warning for missing native modules #19845

Merged
merged 2 commits into from Nov 3, 2022

Conversation

Kudo
Copy link
Contributor

@Kudo Kudo commented Nov 3, 2022

Why

the native modules checking will throw an error that is too aggressive and the error stacktrace is little confused.

 ERROR  Error: Your JavaScript code tried to access a native module, FOO, that isn't supported in Expo Go.
To continue development with FOO, you need to create a development build of your app. See https://expo.fyi/missing-native-module for more info, 
including how to disable these errors.
 ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
 ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.

as we are not very confident with this approach in the meantime, we should send a warning rather than an error.

How

use console.warn than throwing errors.

Test Plan

  • bare-expo + NativeModules.FOO in App.js

Checklist

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Nov 3, 2022
@Kudo Kudo marked this pull request as ready for review November 3, 2022 15:42
@Kudo Kudo requested a review from lukmccall November 3, 2022 15:42
@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Nov 3, 2022
Copy link
Member

@tsapeta tsapeta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just remove this proxy? 😆 As I predicted, it brings more trouble than it's worth...

@Kudo
Copy link
Contributor Author

Kudo commented Nov 3, 2022

Can we just remove this proxy? 😆 As I predicted, it brings more trouble than it's worth...

as the discussion, we will revert the native modules checking and reconsider it in sdk 48. i'll merge this pr to make sure we're doing right when we pick this feature back.

@Kudo Kudo merged commit cb30a98 into main Nov 3, 2022
@Kudo Kudo deleted the @kudo/sdk47/warn-nativemodules branch November 3, 2022 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: passed checks ExpoBot has nothing to complain about
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants