Instabug / Instabug-React-Native

In-app feedback and bug reporting tool for React Native
https://instabug.com/platforms/react-native
MIT License
308 stars 100 forks source link

Error loading JS bundle when running on Android #1161

Closed haozhutw closed 4 months ago

haozhutw commented 4 months ago

A build error is introduced since 12.7.0, please see screenshot below.

Screenshot_1709550396

Did you test the library before you publish the new version?

SDK Version

"instabug-reactnative": "12.7.0",

Device Model

Android simulator

[Optional] Project That Reproduces the Issue

just upgrade instabug-reactnative to 12.7.0, build on Android simulator successfully and then failed to load the js bundle because of this error

error node_modules/instabug-reactnative/src/modules/Instabug.ts: Unexpected token: operator (?) in file node_modules/instabug-reactnative/src/modules/Instabug.ts at 52:36. Run CLI with --verbose flag for more details.

This is the screenshot of the code in instabug-reactnative

Screenshot 2024-03-04 at 19 09 42
ahmedAlaaInstabug commented 4 months ago

Hello @haozhutw 👋 , Thanks for reporting this issue, I'll check this out and will get back to you with more info as soon as possible.

ahmedAlaaInstabug commented 4 months ago

hello @haozhutw 👋, Can you please provide the node version you used ?

haozhutw commented 4 months ago

hello @haozhutw 👋, Can you please provide the node version you used ?

node version: v18.19

I downgrade the instabug-reactnative to v12.6.0, no error occurs.

haozhutw commented 4 months ago

Maybe ??= is too advanced for some old environment, can you make it compatible like this?

if (!config.networkInterceptionMode) {
    config.networkInterceptionMode = NetworkInterceptionMode.javascript;
}
stale[bot] commented 4 months ago

This issue has been automatically marked as pending feedback because we need additional information to be able to investigate it further. It will be closed in 7 days if it remains inactive. Thank you for your contributions.

ahmedAlaaInstabug commented 4 months ago

hello @haozhutw can you please try this version and let us know if it fixes your issue?

Installation

You can install the snapshot through NPM:

npm install https://github.com/Instabug/Instabug-React-Native\#snapshot/fix-init-function-error-on-old-node-version

or Yarn:

yarn add https://github.com/Instabug/Instabug-React-Native\#snapshot/fix-init-function-error-on-old-node-version
stale[bot] commented 4 months ago

This issue has been automatically marked as pending feedback because we need additional information to be able to investigate it further. It will be closed in 7 days if it remains inactive. Thank you for your contributions.

gvillenave commented 4 months ago

@ahmedAlaaInstabug I see that the PR with the fix was merged, but it doesn't seem that a new version was released with that fix? Can this be prioritized? FWIW, it's not due to using an old version of TypeScript, this reproduces on 5.4.3. I've found other reports indicating that the nullish coalescing operator might not be currently supported by the React Native bundler.

leethree commented 4 months ago

We are seeing this issue. It's not supported syntax in React Native. It has nothing to do with Typescript version or Node version.