title: React not defined when installed with webpack
body: <p>I am trying to install React using webpack. It's part of a Rails project. I'm following <a href="http://clarkdave.net/2015/01/how-to-use-webpack-with-rails/" rel="nofollow noreferrer">this tutorial</a></p>
  
  <p>The tutorial recommends removing everything from app/assets/javascripts (which I have not done yet - I still have jquery, jquery_ujs, and d3 in there) putting my javascript into a separate directory and making that my 'source', and then making app/assets/javascripts the 'destination' directory in my webpack configuration. I have named my source directory app/frontend/javascripts, in keeping with the tutorial.</p>
  
  <p>Here's what my webpack.config.js file looks like:</p>
  
  <pre><code>'use strict';
  
  var path = require('path');
  var webpack = require('webpack');
  
  module.exports = [{
    name: 'chartComponent',
    entry: './app/frontend/javascripts/entry.js',
    output: {
      path: path.join(__dirname, 'app', 'assets', 'javascripts'),
      filename: 'bundle.js'
    },
    module: {
      loaders: [
        {
          test: [/\.jsx$/],
          loaders: ["jsx-loader?insertPragma=React.DOM&amp;harmony"],
        }
      ],
    },
    resolve: {
      extensions: ['.webpack.js', '.web.js', '.js', '.jsx']
    }
  }];
  </code></pre>
  
  <p>I confess I don't know what all these settings do, particularly the 'loaders' settings, but it's my understanding that 'entry' should point to the entry point for my webpack-ed javascript, and 'output' should specify the directory and filename for the compiled javascript.</p>
  
  <p>I have specified the file 'app/frontend/javascripts/entry.js' as my entry point. The file looks like this:</p>
  
  <pre><code>var React = require('react');
  var ReactDOM = require('react-dom');
  var Chart = require('react-d3-core').Chart;
  var LineChart = require('react-d3-basic').LineChart;
  </code></pre>
  
  <p>Webpack runs ok, and generates the file 'app/assets/javascripts/bundle.js', as expected. However, when I include the bundle file either in my Rails app, or in my Jasmine test, the global vars React, ReactDOM, etc, are not available. At the console, attempting to access React, I get: </p>
  
  <blockquote>
    <p>Uncaught ReferenceError: React is not defined</p>
  </blockquote>
  
  <p>I can successfully access the global variables <code>d3</code> and <code>$</code> set up by d3.js and jquery.js respectively, but I am not managing those through webpack.</p>
  
  <p>I think I must be wrong in expecting the variables set up in my webpack entry file to be available. Moreover, it seems like such a variable should be set up within the included file, not declared by me - just like <code>d3</code> and <code>$</code> are set up without my declaring them and setting their value. But, when I look at bundle.js, I do see <code>var React = ....</code>. (In more than one place, which I don't get, but whatever). So I would think the variable would at least be defined.</p>
  
  <p>In short, how do I access React (or any other library I've included with webpack) from my app and tests? Any help appreciated!</p>