Strip dev only modules

Summary: public

Make sure some modules that are only available in dev mode are only
included in dev bundles.

Depends on: D2663838

Reviewed By: davidaurelio

Differential Revision: D2663889

fb-gh-sync-id: 42be40b865ef305828b3519556125af090ec61f4
This commit is contained in:
Tadeu Zagallo 2015-11-18 09:11:09 -08:00 committed by facebook-github-bot-7
parent 9e670a64fc
commit 7a794cc72b
2 changed files with 12 additions and 7 deletions

View File

@ -180,11 +180,13 @@ function setUpNumber() {
function setUpDevTools() {
// not when debugging in chrome
if (__DEV__ && !window.document && require('Platform').OS === 'ios') {
if (__DEV__) { // TODO(9123099) Strip `__DEV__ &&`
if (!window.document && require('Platform').OS === 'ios') {
var setupDevtools = require('setupDevtools');
setupDevtools();
}
}
}
setUpProcessEnv();
setUpConsole();
@ -202,6 +204,8 @@ setUpDevTools();
// Just to make sure the JS gets packaged up. Wait until the JS environment has
// been initialized before requiring them.
if (__DEV__) {
require('RCTDebugComponentOwnership');
}
require('RCTDeviceEventEmitter');
require('PerformanceLogger');

View File

@ -10,16 +10,17 @@
*/
'use strict';
var Inspector = require('Inspector');
var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
var React = require('React');
var StyleSheet = require('StyleSheet');
var Subscribable = require('Subscribable');
var View = require('View');
var WarningBox = require('WarningBox');
var invariant = require('invariant');
var Inspector = __DEV__ ? require('Inspector') : null;
var WarningBox = __DEV__ ? require('WarningBox') : null;
var AppContainer = React.createClass({
mixins: [Subscribable.Mixin],
@ -28,7 +29,7 @@ var AppContainer = React.createClass({
},
toggleElementInspector: function() {
var inspector = this.state.inspector
var inspector = !__DEV__ || this.state.inspector
? null
: <Inspector
rootTag={this.props.rootTag}