title: Can't display background image in node js
body: <p>I'm building a simple web page for a test I have to do using a node.js server. I can easily include an image via src like this: </p>
  
  <p><code>&lt;img src="assets/young-woman.jpg"&gt;</code>  </p>
  
  <p>However, when I try to do this: </p>
  
  <p><code>style="background-image: url(assets/young-woman.jpg);"</code> </p>
  
  <p>...it doesn't work. </p>
  
  <p>I have tried following the various solutions to this problem such as: <a href="https://github.com/webpack-contrib/css-loader/issues/256" rel="nofollow noreferrer">https://github.com/webpack-contrib/css-loader/issues/256</a> and this <a href="https://stackoverflow.com/questions/37288886/webpack-background-images-not-loading">Webpack - background images not loading</a> but none of the solutions work for me. </p>
  
  <p>It also works fine if I do it via the CSS like so: </p>
  
  <pre><code>.element {
      background-image: url(../assets/young-woman.jpg);
  }
  </code></pre>
  
  <p>Clearly there must be something wrong with my webpack.config file?</p>
  
  <pre><code>const HtmlWebpackPlugin = require('html-webpack-plugin');
  const CleanWebpackPlugin = require('clean-webpack-plugin');
  const ExtractTextPlugin = require("extract-text-webpack-plugin");
  const webpack = require('webpack');
  const path = require('path');
  
  module.exports = {
      entry: {
          app: './src/index.js',
      },
      devServer: {
          contentBase: './dist'
      },
      devtool: "source-map",
      module: {
          rules: [
              {
                  test: /\.scss$/,
                  use: ExtractTextPlugin.extract({
                      fallback: 'style-loader',
                      use: [{
                          loader: "css-loader", options: {
                              sourceMap: true
                          }
                      }, {
                          loader: "sass-loader", options: {
                              sourceMap: true
                          }
                      }],
                      publicPath: '../',
                  })
              },
              {
                  test: /\.(png|jp(e*)g|gif)$/,
                  use: [{
                      loader: 'file-loader',
                      options: {
                          name: '[name].[ext]',
                          outputPath: 'img/'
                      }
                  }]
              },
              {
                  test: /\.(html)$/,
                  use: {
                      loader: 'html-loader',
                      options: {
                          attrs: [':src']
                      }
                  }
              },
              {
                  test: /\.js$/,
                  exclude: /(node_modules|bower_components)/,
                  use: {
                      loader: 'babel-loader',
                      options: {
                          presets: ['env']
                      }
                  }
              }
          ]
      },
      plugins: [
          new ExtractTextPlugin({
              filename: "css/[name].[contenthash].css",
          }),
          new CleanWebpackPlugin(['dist']),
          new HtmlWebpackPlugin({
              template: 'src/index.html',
              inject: 'body',
              filename: 'index.html'
          }),
          new webpack.ProvidePlugin({
              $: 'jquery',
              jQuery: 'jquery',
              'window.jQuery': 'jquery',
              Popper: ['popper.js', 'default'],
              Util: "exports-loader?Util!bootstrap/js/dist/util",
              Dropdown: "exports-loader?Dropdown!bootstrap/js/dist/dropdown",
          })
      ],
      output: {
          filename: '[name].js',
          path: path.resolve(__dirname, 'dist'),
          publicPath: ''
      }
  }
  </code></pre>
  
  <p>When I try to load the resources in a browser I just get <code>Cannot GET /assets/young-woman.jpg</code></p>
  
  <p>I've tried installing express, but that also doesn't work for me and I get an error about <em>fs</em>. I can't seem to get my head around this. Is it a problem with my set up perhaps? </p>
  
  <p>Thanks in advance</p>