title: How to access webpack generated js file from index.html
body: <p>I have a Flask app that is serving a template <code>index.html</code>, which in turn access a javascript file generated by webpack. The issue is that I am generating a hash for the webpack generated file, to prevent the browser from caching, and I cannot figure out how to access the webpack generated file, as the hash name can change. For example, if the webpack generates a file called <code>bundle-cdcf74127a4e321fbcf0.js</code>, I would not know the hash function <code>cdcf74127a4e321fbcf0</code> ahead of time, and so I could not access it in <code>index.html</code>. </p>
  
  <p>Here is my webpack config file:</p>
  
  <pre><code>const CleanWebpackPlugin = require('clean-webpack-plugin');
  
  module.exports = {
      entry: "./js/main.js",
      output: {
          filename: "static/bundle-[hash].js",
      },
      resolveLoader: {
      moduleExtensions: ['-loader']
      },
      module: {
          loaders: [
              {
                  test: /\.jsx?$/,
                  exclude: /(node_modules|bower_components)/,
                  loader: 'babel',
                  query: {
                      presets: ['react', 'es2015', 'stage-0']
                  }
              },
              {
                  test: /\.css$/,
                  loader: 'style-loader',
              },
              {
                  test: /\.css$/,
                  loader: 'css-loader',
                  query: {
                      modules: true,
                      localIdentName: '[name]__[local]___[hash:base64:5]'
                  }
              }
          ]
      },
      plugins: [new CleanWebpackPlugin(['static/bundle*.js'])]
  };
  </code></pre>
  
  <p>The code used to call the webpack generated file in <code>index.html</code> is below (this code does not work, as it appears that asterisk search does not work in the file name here):</p>
  
  <pre><code>&lt;body&gt;
      &lt;div id="app"&gt;&lt;/div&gt;
      &lt;script src="bundle*.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>The flask app code goes like:</p>
  
  <pre><code>app = Flask(__name__, static_url_path='')
  @app.route('/')
  def default():
      return render_template('index.html')
  </code></pre>
  
  <p>How would I fix this code so that it serves the webpack generated file?</p>