title: Express not able to find webpack bundle
body: <p>I'm running an app with Node, Express.js, Webpack, and Handlebars. I've looked all around for the answer, but none have been helpful. Here is my file structure.</p>
  
  <pre><code>Handlebars (top folder)
      dist
          bundle.js
      node_modules
      routes
      src
          css
              input-elements.css
              main.css
          js
              app.js
              dom-loader.js
              server.js 
          index.html
      package.json
      package-lock.json
      webpack.config.js
  </code></pre>
  
  <p>I know Express is pulling from the right locations in my server.js file:</p>
  
  <pre><code>const hbs = require('express-handlebars');
  const path = require('path');
  const express = require('express');
  const app = express();
  const port = 8080;
  
  
  app.set('port', port || 9001);
  app.get('/', (req, res) =&gt; {
      res.sendFile(path.join(__dirname, '../index.html'));
  });    
  
  app.use(express.static(path.resolve('dist')));
  
  app.listen(app.get('port'), function () {
      console.log('Web server listening on port ' + app.get('port'));
  });
  </code></pre>
  
  <p>Here is my webpack.config.js:</p>
  
  <pre><code>const path = require('path');
  const webpack = require('webpack');
  
  module.exports = {
      entry: path.join(__dirname, './src/js/app.js'),
      output: {
          path: path.resolve('dist'),
          filename: 'bundle.js',
          publicPath: '/dist/'
      },
      module: {
          rules: [
              {
                  test: /\.css$/,
                  use: [
                      'style-loader',
                      'css-loader'
                  ]
              }
          ]
      },
  };
  </code></pre>
  
  <p>And my index.html:</p>
  
  <pre><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, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"&gt;
      &lt;meta http-equiv="X-UA-Compatible" content="ie=edge"&gt;
      &lt;title&gt;Webpack 2 Basics&lt;/title&gt;
      &lt;script type="text/javascript" src="../dist/bundle.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1&gt;Let's learn Webpack 2&lt;/h1&gt;
      &lt;button id="secret-button"&gt;Show the Secret&lt;/button&gt;
      &lt;p id="secret-paragraph"&gt;You can't see this all the time&lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre>
  
  <p>Here is my package.json:</p>
  
  <pre><code>{
    "name": "handlebars",
    "version": "1.0.0",
    "description": "",
    "main": "./src/js/app.js",
    "scripts": {
      "test": "echo \"Error: no test specified\" &amp;&amp; exit 1",
      "build": "concurrently \"webpack -p\" \"nodemon ./src/js/server.js --ext html,scss,css,js,json\""
    },
    "author": "",
    "license": "ISC",
    "devDependencies": {
      "concurrently": "^4.0.1",
      "css-loader": "^1.0.0",
      "express": "^4.16.3",
      "express-handlebars": "^3.0.0",
      "nodemon": "^1.18.4",
      "style-loader": "^0.23.0",
      "webpack": "^4.17.1",
      "webpack-cli": "^3.1.0"
    }
  }
  </code></pre>
  
  <p>I can confirm Webpack is building the bundle. In the browser, it has two errors:</p>
  
  <pre><code>#1: Failed to load resource: the server responded with a status of 404 (not 
  found) --&gt; referring to bundle.js
  
  
  #2: Refused to execute script from 'http://localhost:8080/dist/bundle.js' 
  because its MIME type ('text/html') is not executable, and strict MIME type 
  checking is enabled.
  </code></pre>
  
  <p>Express is sending my index.html file but it's not sending the bundle with it. I have app.use(<em>bundle.js</em>) in my server.js file but it's not sending it for some reason. Is there something wrong with my pathing?</p>
  
  <p>Is it due to the fact that I'm using absolute paths here instead of relative paths? If so, is the path module the best to be using here?</p>
  
  <p>Any and all help would be appreciated.</p>