title: How to use React as external package
body: <p>I'm making a small app which will be included to another bigger project(let's call it the Main project) as a external package.
  I'm using "Create React App" for it. </p>
  
  <p>It works fine, but I want to build my app without including React to the bundle file because the Main project will also have React as a dependency for another purposes.</p>
  
  <p>Now I'm trying next:</p>
  
  <ol>
  <li><p>I have run "eject" script on my project so now I have an access to the webpack configs.</p></li>
  <li><p>In the webpack.config.dev.js file I've added next property:  </p>
  
  <pre><code>externals: {
    react: {
      root: 'React',
      commonjs2: 'react',
      commonjs: 'react',
      amd: 'react',
      umd: 'react',
    },
    'react-dom': {
      root: 'ReactDOM',
      commonjs2: 'react-dom',
      commonjs: 'react-dom',
      amd: 'react-dom',
      umd: 'react-dom',
    }
  }
  </code></pre></li>
  <li><p>Now, as I understand, I need to include React and ReactDom to my index.html which is in the public folder.</p></li>
  </ol>
  
  <p>In the body tag I included two scripts from React CDN:</p>
  
  <p><a href="https://reactjs.org/docs/cdn-links.html" rel="nofollow noreferrer">https://reactjs.org/docs/cdn-links.html</a></p>
  
  <p>But when I run npm start it doesn't work and throws the error:</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'Component' of undefined</p>
  </blockquote>
  
  <p>How can I configure "Create React App" to exclude React from the bundle?</p>
  
  <p>Thank you!</p>