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

Source code is not preserved in EAS development builds when 'show source' is used with Hermes #2034

Open
andrey-abstracted opened this issue Aug 31, 2023 · 2 comments
Labels
needs review Issue is ready to be reviewed by a maintainer

Comments

@andrey-abstracted
Copy link

andrey-abstracted commented Aug 31, 2023

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',
},
});

@andrey-abstracted andrey-abstracted added the needs review Issue is ready to be reviewed by a maintainer label Aug 31, 2023
@AlanSl
Copy link

AlanSl commented Feb 24, 2024

Edit: my specific similar issue below (it not working on first load only) seems to be a known issue on Hermes: 'show source' does not work on first run when debugging, see also Hermes "show source" not working in debug mode. which is similar but not resolved in hot reloads.


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.

Given something like this:

function someFunction () {
  'show source'
  return 'hello'
}
console.log(someFunction.toString())
  • If I start an Expo app that already contains this, the 'show source' is ignored and it just shows [byteCode]:
    image
  • If I make a change and save the file (triggering hot reload), suddenly the 'show source' works as expected:
    image
  • If I then cause a reload (e.g. press r in the console), then it goes back to the failing case showing [byteCode]:
    image

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.

@andflett
Copy link

@AlanSl realise it's been months, but did you ever find a way around this? Experiencing exactly the same thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Issue is ready to be reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

3 participants