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

[Question] react-native-bundle --dev argument does not appear to be working #4181

Closed
andrewsardone opened this Issue Nov 17, 2015 · 9 comments

Comments

Projects
None yet
8 participants
@andrewsardone
Contributor

andrewsardone commented Nov 17, 2015

I'm up against an issue where my bundled JS seems to be perpetually in __DEV__ mode, and I'm curious if anyone else has seen this problem or has a solution.

I am not using a react-native init’d project, but instead a home-rolled hybrid app. I'm running the following react-native bundle command to generate my main.jsbundle file:

react-native bundle --dev false --entry-file index.ios.js --platform ios --bundle-output main.jsbundle

The command generates my bundle, and I'm able to compile and run my app. My main.jsbundle starts with __DEV__=!1, but I don't think I'm actually running in a non-dev-mode. When starting the app, I'm seeing the 'Loading from pre-bundled file' message, and my console is logging out my views' params:

[info][tid:com.facebook.React.JavaScript] 'Running application "ReactApp" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF'

The __DEV__ === true, development-level warning are ON message leads me to believe that the bundle was not properly compiled for production.

Any thoughts? Any known issues, or areas I can investigate? Nothing popped up for me when searching across issues, and I came across the --dev flag via bundleCommandLineArgs.js.

My current relevant dependencies:

  • "react-native": "^0.14.1"
  • "react-native-cli": "^0.1.7"

Thanks!

@eyaleizenberg

This comment has been minimized.

Contributor

eyaleizenberg commented Nov 22, 2015

same here

andrewsardone added a commit to andrewsardone/react-native that referenced this issue Nov 23, 2015

Clarify --dev flag for react-native-bundle
Given some [confusion around `react-native bundle`'s `--dev` flag][1],
this hopes to clear somet things up int he docs by…

- Removing mentions of the `__DEV__` environment variable
    - I think it confuses the user on how to work with the command-line
      flag, and frankly it seems like an internal implementation detail
      from the perspective of react-native-cli. We should focus on what
      the `--dev` flag does (e.g., toggles dev warnings, performance
      optimizations).
- Adding a minimal note about native-land's build configurations and how
  that should be checked for production builds

[1]: facebook#4181
@andrewsardone

This comment has been minimized.

Contributor

andrewsardone commented Nov 23, 2015

I figured out my problem – I realized that this was a non-issue.

Given that my main.jsbundle starts with __DEV__=!1 and looks minified, react-native bundle --dev false is properly working.

As for seeing the 'Loading from pre-bundled file' message, and my console logging out my views' params, this was because my Xcode build configuration was set to DEBUG.

In native-land, React Native sets up its own RCT_DEBUG definition. Internally, RCTLog() determines its logging behavior based on RCT_DEBUG. That explains why I was still seeing logging of my view's params and such.

Similarly there's an RCT_DEV definition based on Xcode's DEBUG build configuration. This definition dictates, for example, whether or not the 'Loading from…' status bar view is shown, or the shake-to-show dev menu is enabled.


I have attempted to clarify these points in the docs via this PR: #4299

@ide

This comment has been minimized.

Collaborator

ide commented Nov 23, 2015

Thanks for following up with a PR!

@JakeRawr

This comment has been minimized.

Contributor

JakeRawr commented Nov 25, 2015

Hi,

It does show__DEV__=!1 but i believe optimization is still off.
I also see this in the Xcode console:
'Running application "IOS_99GAMERS" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF'
I've tried setting __Dev__ = false directly from main.jsbundle. It didn't work.

Any idea what I can do to set Dev to be false?

This is my command:

react-native bundle --entry-file index.ios.js --bundle-output iOS/main.jsbundle --platform 'ios'  --dev false

My current relevant dependencies:

"react-native": "^0.15.0"

@JakeRawr

This comment has been minimized.

Contributor

JakeRawr commented Nov 25, 2015

Sorry, I figured out my own problem. as @andrewsardone said, Xcode build configuration has to set to "Release" for development mode.

Here's how for people who want to know:
screen shot 2015-11-25 at 10 58 57 am
Select "Edit Scheme"

screen shot 2015-11-25 at 10 57 54 am

Change build configuration to Release

When launching the app on device via xcode, shake your device, if no developer menu shows up, it's in development mode.

sunnylqm added a commit to sunnylqm/react-native that referenced this issue Dec 2, 2015

Clarify --dev flag for react-native-bundle
Given some [confusion around `react-native bundle`'s `--dev` flag][1],
this hopes to clear somet things up int he docs by…

- Removing mentions of the `__DEV__` environment variable
    - I think it confuses the user on how to work with the command-line
      flag, and frankly it seems like an internal implementation detail
      from the perspective of react-native-cli. We should focus on what
      the `--dev` flag does (e.g., toggles dev warnings, performance
      optimizations).
- Adding a minimal note about native-land's build configurations and how
  that should be checked for production builds

[1]: facebook#4181

Crash-- added a commit to Crash--/react-native that referenced this issue Dec 24, 2015

Clarify --dev flag for react-native-bundle
Given some [confusion around `react-native bundle`'s `--dev` flag][1],
this hopes to clear somet things up int he docs by…

- Removing mentions of the `__DEV__` environment variable
    - I think it confuses the user on how to work with the command-line
      flag, and frankly it seems like an internal implementation detail
      from the perspective of react-native-cli. We should focus on what
      the `--dev` flag does (e.g., toggles dev warnings, performance
      optimizations).
- Adding a minimal note about native-land's build configurations and how
  that should be checked for production builds

[1]: facebook#4181
@ghost

This comment has been minimized.

ghost commented May 27, 2016

I am still getting
"Running application with appParams: {"rootTag":1,"initialProps":{}}. DEV === true, development-level warning are ON, performance optimizations are OFF"

as well as a white blank screen in simulator

@pareekkhushboo77

This comment has been minimized.

pareekkhushboo77 commented Aug 10, 2016

@edbrooks any luck for white blank screen

@Amurmurmur

This comment has been minimized.

Amurmurmur commented Aug 17, 2016

My app crashes on boot when running this:
react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle

and building a signed APK.

Could anybody give any advise?

@godfredcs

This comment has been minimized.

godfredcs commented Jun 14, 2017

Guys I also have the same problem. I'm using expo and I'm getting DEV === true, development-level warning are ON, performance optimizations are OFF. My apps take too long to open up on my simulator so I'm stuck with this white blank screen.

Can I get any help please?

@facebook facebook locked as resolved and limited conversation to collaborators Jul 20, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.