You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In EAS development builds .toString() returns byte code for functions where 'show source' directive is used which should be preserving source code with Hermes. Works correctly in EAS production builds.
I see the same issue (Expo 50.0.7 and 49.0.15), but curiously, only in the initial load, not on "hot reload" after making and saving an incidental change. There's another similar report over on the original issue on Hermes, that is also specific to Expo and mentions it being only on initial dev build load, and not hot reload.
If I start an Expo app that already contains this, the 'show source' is ignored and it just shows [byteCode]:
If I make a change and save the file (triggering hot reload), suddenly the 'show source' works as expected:
If I then cause a reload (e.g. press r in the console), then it goes back to the failing case showing [byteCode]:
If "Fast Refresh" is disabled in the Expo Dev menu, it always shows the [byteCode] fail case; if I re-enable it, it does a hot reload that causes the full function code to show, and reverts to the above behaviour.
Build/Submit details page URL
https://expo.dev/accounts/duxa/projects/test-app/builds/e026acc3-9e93-492b-921b-4eaca532e769
Summary
In EAS development builds .toString() returns byte code for functions where 'show source' directive is used which should be preserving source code with Hermes. Works correctly in EAS production builds.
This is the description of the directive
facebook/hermes#114 (comment)
It is possible that the Metro bundler strips the bundle of the directive
Managed or bare?
eas build
Environment
expo-env-info 1.0.5 environment info:
System:
OS: macOS 13.5
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.16.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.8.1 - /usr/local/bin/npm
Watchman: 2023.06.26.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7583922
Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
npmPackages:
expo: ~49.0.8 => 49.0.8
react: 18.2.0 => 18.2.0
react-native: 0.72.4 => 0.72.4
npmGlobalPackages:
eas-cli: 5.0.2
Expo Workflow: managed
Error output
showMySource.toString() prints out the following:
function showMySource() { [bytecode] }
Reproducible demo or steps to reproduce from a blank project
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';
export default function App() {
function showMySource(){
'show source';
var a = 3;
var b = 4;
var c = a+b;
}
return (
<View style={styles.container}>
<Text>{showMySource.toString()}</Text>
<StatusBar style="auto" />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
The text was updated successfully, but these errors were encountered: