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

replacing "react-native bundle" calls by "react-native rnx-bundle" results in huge console logs #2419

Closed
4 of 5 tasks
Thanaen opened this issue May 16, 2023 · 6 comments
Closed
4 of 5 tasks
Labels
bug Something isn't working feature: cli This is related to CLI needs attention Extra attention is needed

Comments

@Thanaen
Copy link

Thanaen commented May 16, 2023

What happened?

Hello,

I have set up rnx-kit to bundle my application.
I replaced the react-native start scripts with react-native rnx-start, and it works perfectly.

I also wanted to replace the calls to react-native bundle with react-native rnx-bundle. (For Android, I used bundleCommand = "rnx-bundle" in build.gradle, and for iOS I used export BUNDLE_COMMAND=rnx-bundle in the bundle phase on XCode.

For Android, this works, but there is a problem: the whole generated js bundle is logged in the console, and I suspect it is logged several times in a row because my log file was over 300 megabytes at the end of the build.

For iOS, when trying to archive, it also logs a lot of lines related to the source code, but the bundle step never finishes (as if the bundle script was still in "waiting for input" mode).

So several questions:

  • Can we use rnx-bundle as a drop-in replacement for react-native bundle?
  • Did I forget some parameters that would have allowed to avoid these logs ?

If we can't replace react-native bundle directly by react-native rnx-bundle, how should we use it?

Affected Package

@rnx-kit/cli

Version

0.16.9

Which platforms are you seeing this issue on?

  • Android
  • iOS
  • macOS
  • Windows

System Information

For some reasons, running "npx react-native info" returns "unknown command 'info'"

Steps to Reproduce

  1. Create a new react-native project
  2. Setup rnx-kit bundling (https://microsoft.github.io/rnx-kit/docs/guides/bundling#setting-up-the-tools)
  3. In "./android/app/build.gradle", set "bundleCommand" to "rnx-bundle"
  4. For iOS, in XCode, add this line to the bundle phase script: "export BUNDLE_COMMAND=rnx-bundle"
  5. Generate an Android APK, and an iOS Archive

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Thanaen Thanaen added the bug Something isn't working label May 16, 2023
@Rag0n
Copy link

Rag0n commented May 16, 2023

Same issue for me

@tido64
Copy link
Member

tido64 commented May 19, 2023

Do you use Hermes? Do these "huge console logs" come from the Hermes compiler? If so, try this workaround to disable warnings: #2416 (comment)

We can't control the console output of Hermes. If you think this is a real issue, you should file it on their GitHub instead.

@Thanaen
Copy link
Author

Thanaen commented May 19, 2023

I do use Hermes!
I will try that, thanks! Do you think this is what is blocking the bundle in XCode? (maybe I should create a new issue for this)

@microsoft-github-policy-service microsoft-github-policy-service bot added needs attention Extra attention is needed and removed needs author feedback labels May 19, 2023
@tido64
Copy link
Member

tido64 commented May 19, 2023

For the blocking bundle issue, do you have a repro? I've not seen this myself so having a repro would help us investigate.

@tido64 tido64 added needs author feedback and removed needs attention Extra attention is needed labels May 19, 2023
@Thanaen
Copy link
Author

Thanaen commented May 19, 2023

At this time, I did not publish a repro project.
I might try to put one up next week.

The repro steps are pretty simple:

  • In the bundle phase of XCode, add the line export BUNDLE_COMMAND=rnx-bundle, then generate an archive.

I'll try to set one up as soon as I have some free time (and a Macbook available!)

@tido64
Copy link
Member

tido64 commented May 23, 2023

For fix and workaround, see #2416 (comment).

@tido64 tido64 closed this as completed May 23, 2023
facebook-github-bot pushed a commit to facebook/react-native that referenced this issue May 23, 2023
Summary:
Limit diagnostics width output by `hermesc` as they may cause slowdowns or even crashes in Gradle/Xcode when a minified bundle is used as input. This occurs because Hermes is unable to determine the terminal width when executed by Gradle/Xcode, and falls back to "unlimited". If the input is a minified bundle, Hermes will output the whole bundle for each warning.

See issues filed:
- microsoft/rnx-kit#2416
- microsoft/rnx-kit#2419
- microsoft/rnx-kit#2424

## Changelog:

[GENERAL] [FIXED] - Limit diagnostics width output by `hermesc`

Pull Request resolved: #37531

Test Plan: See listed issues for repros.

Reviewed By: cipolleschi

Differential Revision: D46102686

Pulled By: cortinico

fbshipit-source-id: 1b821cad7ef0d561a5e1c13a7aedf9b10164620a
kelset pushed a commit to facebook/react-native that referenced this issue May 25, 2023
Summary:
Limit diagnostics width output by `hermesc` as they may cause slowdowns or even crashes in Gradle/Xcode when a minified bundle is used as input. This occurs because Hermes is unable to determine the terminal width when executed by Gradle/Xcode, and falls back to "unlimited". If the input is a minified bundle, Hermes will output the whole bundle for each warning.

See issues filed:
- microsoft/rnx-kit#2416
- microsoft/rnx-kit#2419
- microsoft/rnx-kit#2424

## Changelog:

[GENERAL] [FIXED] - Limit diagnostics width output by `hermesc`

Pull Request resolved: #37531

Test Plan: See listed issues for repros.

Reviewed By: cipolleschi

Differential Revision: D46102686

Pulled By: cortinico

fbshipit-source-id: 1b821cad7ef0d561a5e1c13a7aedf9b10164620a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature: cli This is related to CLI needs attention Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants