title: what is the proper way to publish a React component module in NPM without external dependencies inside?
body: <p>I'm trying to publish in NPM a component library made with React.</p>
  
  <p>I don't want that it have external dependencies, even React modules, to have smallest possible file size and because the user will add this dependencies in the app.</p>
  
  <p>I'm using <code>npm</code> and <code>webpack</code> to manage the dependencies.</p>
  
  <ul>
  <li><p>This is my <code>package.json</code> dependencies:</p>
  
  <pre><code>"devDependencies": {
      "webpack": "^1.13.1",
      "webpack-dev-server": "^1.14.1",
      "webpack-merge": "^0.13.0",
      "babel-core": "^6.9.1",
      "babel-loader": "^6.2.4",
      "babel-preset-es2015": "^6.6.0",
      "babel-preset-react": "^6.5.0",
      "babel-preset-react-hmre": "^1.1.1",
      "react": "^15.0.2",
      "react-dom": "^15.0.2"
    },
   "peerDependencies": {
     "react": "^15.0.2",
     "react-dom": "^15.0.2"
   }
  </code></pre></li>
  <li><p>In my <code>webpack.config.js</code> file I have entry point as 'component.jsx' and output as 'lib.js' file</p>
  
  <pre><code>// Source code entry
  entry: {
    lib: './src/components/component.jsx'
  },
  
  // Code Output 
  output: {
    path: PATHS.build,
    filename: 'lib.js'
  },
  </code></pre></li>
  <li><p>I also included the "externals" attribute with the react modules to avoid webpack including it in the 'lib.js' output.</p>
  
  <pre><code>externals: {
    'react': 'React',
    'react-dom' : 'ReactDOM'
  }
  </code></pre></li>
  <li><p>Finally this is the simple React component that i want to publish:</p>
  
  <pre><code>import React from 'react';
  
  export default class Component extends React.Component {
  
    constructor() {
      super();
    }
  
    render() {
      return (
        &lt;h1&gt;MY COMPONENT&lt;/h1&gt;
      );
    }
  }
  </code></pre></li>
  </ul>
  
  <p>I published it to NPM and installed it in another project. When I tried to use it after import React statement, it gives me an error saying that React is not defined (bundle.js:28448 Uncaught ReferenceError: React is not defined)</p>
  
  <ul>
  <li><p>My code to probe the component:</p>
  
  <pre><code>import React from 'react';
  import ReactDOM from 'react-dom';
  import Component from 'component';
  import $ from 'jquery';
  
  ReactDOM.render(
     &lt;Component /&gt;,
     $("#app")
  );
  </code></pre></li>
  </ul>
  
  <p>Am I missing anything in the dependencies config?</p>
  
  <p>Thanks</p>