title: How to set React to production mode when using Gulp
body: <p>I need to run React in production mode, which presumably entails defining the following somewhere in the enviornment:</p>
  
  <pre><code>process.env.NODE_ENV = 'production';
  </code></pre>
  
  <p>The issue is that I'm running this behind Tornado (a python web-server), not Node.js. I also use Supervisord to manage the tornado instances, so it's not abundantly clear how to set this in the running environment.</p>
  
  <p>I do however use Gulp to build my jsx files to javascript. </p>
  
  <p>Is it possible to somehow set this inside Gulp? And if so, how do I check that React is running in production mode?</p>
  
  <p>Here is my Gulpfile.js:</p>
  
  <pre><code>'use strict';
  
  var gulp = require('gulp'),
          babelify = require('babelify'),
          browserify = require('browserify'),
          browserSync = require('browser-sync'),
          source = require('vinyl-source-stream'),
          uglify = require('gulp-uglify'),
          buffer = require('vinyl-buffer');
  
  var vendors = [
      'react',
      'react-bootstrap',
      'jquery',
  ];
  
  gulp.task('vendors', function () {
          var stream = browserify({
                          debug: false,
                          require: vendors
                  });
  
          stream.bundle()
                      .pipe(source('vendors.min.js'))
                      .pipe(buffer())
                      .pipe(uglify())
                      .pipe(gulp.dest('build/js'));
  
          return stream;
  });
  
  gulp.task('app', function () {
          var stream = browserify({
                          entries: ['./app/app.jsx'],
                          transform: [babelify],
                          debug: false,
                          extensions: ['.jsx'],
                          fullPaths: false
                  });
  
          vendors.forEach(function(vendor) {
                  stream.external(vendor);
          });
  
          return stream.bundle()
                                   .pipe(source('build.min.js'))
                                   .pipe(buffer())
                                   .pipe(uglify())
                                   .pipe(gulp.dest('build/js'));
  
  });
  
  gulp.task('watch', [], function () {
      // gulp.watch(['./app/**/*.jsx'], ['app', browserSync.reload]);
      gulp.watch(['./app/**/*.jsx'], ['app']);
  });
  
  gulp.task('browsersync',['vendors','app'], function () {
          browserSync({
              server: {
                  baseDir: './',
              },
              notify: false,
              browser: ["google chrome"]
      });
  });
  
  gulp.task('default',['browsersync','watch'], function() {});
  </code></pre>