title: How to fix "Uncaught TypeError: Cannot read property 'call' of undefined" in webpack?
body: <p>Basically I'm setting up webpack and when I tried getting dev-server in development mode in webpack, I ran into this Error. </p>
  
  <p>I tried following some instructions in other things, tried from beginning twice, but still getting the same error. I can't figure out what I am doing wrong here. If anyone has solution onto this issue, I'd very much appreciate that. Thanks. </p>
  
  <p>Error I'm getting:</p>
  
  <pre><code>bundle.js:20 Uncaught TypeError: Cannot read property 'call' of undefined
      at __webpack_require__ (bundle.js:20)
      at eval (index.js:2)
      at Object../src/js/index.js (bundle.js:357)
      at __webpack_require__ (bundle.js:20)
      at eval (webpack:///multi_(:8080/webpack)-dev-server/client?:2:18)
      at Object.0 (bundle.js:368)
      at __webpack_require__ (bundle.js:20)
      at bundle.js:69
      at bundle.js:72
  </code></pre>
  
  <p>Specifics of error:</p>
  
  <pre><code>// Execute the module function
  /******/        modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  </code></pre>
  
  <p>webpack.config.js:</p>
  
  <pre><code>const path = require('path');
  
  module.exports = {
      entry: './src/js/index.js',
      output: {
          path: path.resolve(__dirname, 'dist'),
          filename: 'js/bundle.js'
      },
      devServer: {
          contentBase: './dist'
      }
  };
  </code></pre>
  
  <p>package.json:</p>
  
  <pre><code>{
      "name": "forkify",
      "version": "1.0.0",
      "description": "forkify project",
      "main": "index.js",
      "scripts": {
          "dev": "webpack --mode development",
          "build": "webpack --mode production",
          "start": "webpack-dev-server --mode development --open"
      },
      "author": "Jonas Schmedtmann",
      "license": "ISC",
      "devDependencies": {
          "webpack": "^4.2.0"
      },
      "dependencies": {
          "webpack-cli": "^2.1.5",
          "webpack-dev-server": "^3.4.1"
      }
  }
  </code></pre>
  
  <p>index.html:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
      &lt;meta http-equiv="X-UA-Compatible" content="ie=edge"&gt;
      &lt;title&gt;Document&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;script src="js/bundle.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I expect any solutions to this.</p>