title: How to fix "Module not found: Error: Can't resolve *" error
body: <p>I am using very basic webpack configuration with 3rd party modules being used in my server.js. While compiling with webpack, i am getting tons of error all saying that module can not be found. I have searched a lots of similar questions and answers, but i could not find any correct one or any answer actually answering this question...</p>
  
  <p>Some say that i have to include all the missing modules into dependencies, but it's like <em>a lots of these errors</em>, should i really include them all? Some answer was that i can ignore them, but it did not work out for me. Used it like so: <a href="https://github.com/tj/consolidate.js/issues/295#issuecomment-368311241" rel="nofollow noreferrer">Webpack build fails #295</a></p>
  
  <p><strong>Folder structure for server</strong></p>
  
  <p><a href="https://i.stack.imgur.com/1CQbY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1CQbY.png" alt="enter image description here"></a></p>
  
  <p><strong>Webpack config</strong></p>
  
  <pre><code>const path = require("path");
  
  module.exports = {
      mode: "production",
      entry: "./server.js",
      output: {
          path: path.resolve(__dirname, "dist"),
          filename: "server.bundle.js"
      },
      resolve: {
          extensions: [".js", ".jsx"]
      },
      module: {
          rules: [
              {
                  test: /\.js$/,
                  loader: "babel-loader",
                  exclude: path.resolve(__dirname, "node_modules")
              }
          ]
      }
  };
  </code></pre>
  
  <p><strong>Error log</strong></p>
  
  <pre><code>ERROR in ./node_modules/consolidate/lib/consolidate.js
  Module not found: Error: Can't resolve 'vash' in '/Users/X/server/node_modules/consolidate/lib'
   @ ./node_modules/consolidate/lib/consolidate.js 1553:51-66
   @ ./node_modules/consolidate/index.js
   @ ./node_modules/email-templates/lib/index.js
   @ ./common/Helpers.js
   @ ./server.js
  
  ERROR in ./node_modules/consolidate/lib/consolidate.js
  Module not found: Error: Can't resolve 'velocityjs' in '/Users/X/server/node_modules/consolidate/lib'
   @ ./node_modules/consolidate/lib/consolidate.js 201:63-84
   @ ./node_modules/consolidate/index.js
   @ ./node_modules/email-templates/lib/index.js
   @ ./common/Helpers.js
   @ ./server.js
  
  ERROR in ./node_modules/consolidate/lib/consolidate.js
  Module not found: Error: Can't resolve 'walrus' in '/Users/X/server/node_modules/consolidate/lib'
   @ ./node_modules/consolidate/lib/consolidate.js 1023:55-72
   @ ./node_modules/consolidate/index.js
   @ ./node_modules/email-templates/lib/index.js
   @ ./common/Helpers.js
   @ ./server.js
  </code></pre>