Permalink
Browse files

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
  • Loading branch information...
tadeuzagallo authored and facebook-github-bot-7 committed Nov 18, 2015
1 parent 9e670a6 commit 7a794cc72bf5c2ea6da4dbda3a452bafc2997885
@@ -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();
}
}
}
@@ -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');
@@ -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}

1 comment on commit 7a794cc

@hufeng

This comment has been minimized.

hufeng commented on 7a794cc Apr 21, 2016

yes, this is awesome.

Please sign in to comment.