title: Webpack + React + TypeScript: Module not found ... in ... node_modules/react/
body: <p>I'm trying to put together a very basic project with React, TypeScript and Webpack.  When I compile I get the following errors from the <code>react</code> folder in <code>node_modules</code> (I've removed the stack traces and my project's path for brevity):</p>
  
  <pre><code>ERROR in ./node_modules/react/cjs/react.production.min.js
  Module not found: Error: Can't resolve 'fbjs/lib/emptyFunction' in '.../node_modules/react/cjs'
  
  ERROR in ./node_modules/react/cjs/react.development.js
  Module not found: Error: Can't resolve 'fbjs/lib/emptyFunction' in '.../node_modules/react/cjs'
  
  ERROR in ./node_modules/react/cjs/react.production.min.js
  Module not found: Error: Can't resolve 'fbjs/lib/emptyObject' in '.../node_modules/react/cjs'
  
  ERROR in ./node_modules/react/cjs/react.development.js
  Module not found: Error: Can't resolve 'fbjs/lib/emptyObject' in '.../node_modules/react/cjs'
  
  ERROR in ./node_modules/react/cjs/react.development.js
  Module not found: Error: Can't resolve 'fbjs/lib/invariant' in '.../node_modules/react/cjs'
  
  ERROR in ./node_modules/react/cjs/react.development.js
  Module not found: Error: Can't resolve 'fbjs/lib/warning' in '.../node_modules/react/cjs'
  
  ERROR in ./node_modules/react/cjs/react.production.min.js
  Module not found: Error: Can't resolve 'object-assign' in '.../node_modules/react/cjs'
  
  ERROR in ./node_modules/react/cjs/react.development.js
  Module not found: Error: Can't resolve 'object-assign' in '.../node_modules/react/cjs'
  
  ERROR in ./node_modules/react/cjs/react.development.js
  Module not found: Error: Can't resolve 'prop-types/checkPropTypes' in '.../node_modules/react/cjs'
  </code></pre>
  
  <p>I tried uninstalling TypeScript and replacing it with Babel to transpile the JSX and got the same error.  <strong>Installing <code>babel-preset-2015</code> fixed it</strong>.</p>
  
  <p>I've tried just about every combination of <code>target</code> and <code>module</code> in <code>tsconfig.json</code> to get the same result in TypeScript but couldn't get anything working.  <strong>How can I get Webpack, TypeScript, and React working together?</strong></p>
  
  <p>I've worked with all three of these technologies before, is it a recent compatibility problem?  If so what are the most recent compatible versions?</p>
  
  <p>I've seen a few other questions similar to this one where the solution was installing <code>fbjs</code> directly in the project - I've tried this too without success.</p>
  
  <h1>Files</h1>
  
  <h2>tsconfig.json</h2>
  
  <pre><code>{
    "compilerOptions": {
      "target": "es5",
      "jsx": "react",
      "module": "es2015"
    },
    "exclude": ["build"]
  }
  </code></pre>
  
  <h2>webpack.config.js</h2>
  
  <pre><code>module.exports = {
      entry: {
          dev: "./src/index.tsx",
      },
      output: {
          filename: "./build/index.js",
      },
      devtool: "source-map",
      resolve: {
          extensions: [".ts", ".tsx"],
      },
      module: {
          loaders: [
              // Typescript
              { test: /\.tsx?$/, loader: "ts-loader" },
          ],
      },
  };
  </code></pre>
  
  <h2>package.json</h2>
  
  <pre><code>{
      ...
      "scripts": {
          "build": "webpack"
      },
      "devDependencies": {
          "@types/react": "^16.0.28",
          "ts-loader": "^3.2.0",
          "typescript": "^2.6.2",
          "webpack": "^3.10.0"
      },
      "dependencies": {
          "react": "^16.2.0"
      }
  }
  </code></pre>
  
  <h2>./src/index.tsx</h2>
  
  <pre><code>import * as React from "react";
  
  const a = &lt;div /&gt;;
  </code></pre>
  
  <p>(I'm running this with Node 9.2.1 and NPM 5.6.0 installed)</p>