Skip to content

Commit

Permalink
Strip dev only modules
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tadeuzagallo authored and facebook-github-bot-7 committed Nov 18, 2015
1 parent 9e670a6 commit 7a794cc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Expand Up @@ -180,9 +180,11 @@ function setUpNumber() {

function setUpDevTools() {
// not when debugging in chrome
if (__DEV__ && !window.document && require('Platform').OS === 'ios') {
var setupDevtools = require('setupDevtools');
setupDevtools();
if (__DEV__) { // TODO(9123099) Strip `__DEV__ &&`
if (!window.document && require('Platform').OS === 'ios') {
var setupDevtools = require('setupDevtools');
setupDevtools();
}
}
}

Expand All @@ -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.
require('RCTDebugComponentOwnership');
if (__DEV__) {
require('RCTDebugComponentOwnership');
}
require('RCTDeviceEventEmitter');
require('PerformanceLogger');
7 changes: 4 additions & 3 deletions Libraries/ReactIOS/renderApplication.ios.js
Expand Up @@ -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],

Expand All @@ -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}
Expand Down

1 comment on commit 7a794cc

@hufeng
Copy link

@hufeng hufeng commented on 7a794cc Apr 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this is awesome.

Please sign in to comment.