title: Organizing a React JS project - building single JS file
body: <p>I just got started using React. I went through the CommentBox tutorial without any issues. But the framework does not give much/any guidance to organizing your JS files or compiling a single minified JS file for a SPA. I already know the framework is flexible and does not enforce a standard and I'm sure these questions are probably dead obvious for someone who develops in the Javascript ecosystem.</p>
  
  <p>I would imagine the consensus is to use Browserify and in the docs there's a link to a git starter project:</p>
  
  <p><a href="https://github.com/petehunt/react-browserify-template" rel="noreferrer">https://github.com/petehunt/react-browserify-template</a></p>
  
  <p>This is a good start, but still it only compiles a single JS file "index.js". I read through some of the browserify handbook and I thought I simply had to 'require' my other files (and those files need to export themselves).</p>
  
  <p>So I modified index.js to look like this:</p>
  
  <pre><code>/** @jsx React.DOM */
  var React = require('react');
  var pkg = require('./package.json');
  
  var commentBox = require('./comment-box.js');
  </code></pre>
  
  <p>comment-box.js is basically a hello world test:</p>
  
  <pre><code>/** @jsx React.DOM */
  var React = require('react');
  var CommentBox = React.createClass({
      render: function() {
          return (
              &lt;div className="commentBox"&gt;
              Hello, world! I am a CommentBox.
              &lt;/div&gt;
              );
      }
  });
  
  React.renderComponent(
      &lt;CommentBox /&gt;,
      document.getElementById('content')
  );
  
  module.exports = CommentBox;
  </code></pre>
  
  <p>If I run the react-browserify-template's start target it seems to generate browser-bundle.js fine:</p>
  
  <pre><code>npm start
  </code></pre>
  
  <p>But if I try the build target</p>
  
  <pre><code>npm build
  </code></pre>
  
  <p>...nothing happens. I changed the output of npm to verbose and I get the following:</p>
  
  <pre><code>npm info it worked if it ends with ok
  npm verb cli [ 'node', '/usr/local/bin/npm', 'build' ]
  npm info using npm@1.4.21
  npm info using node@v0.10.24
  npm verb exit [ 0, true ]
  npm info ok
  </code></pre>
  
  <p>According to package.json it's supposed to generate a file "browser-bundle.min.js" but instead I get no output.  I'm hoping someone can clear this up.</p>