microsoft/rnx-kit

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

Thanaen opened this issue · 6 comments

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
Rag0n commented

Same issue for me

tido64 commented

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.

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)

tido64 commented

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

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 commented

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