Include direct link to webpack entry points in application HTML?

webpack

Solution

The html-webpack-plugin (I'm the author) will generate an index.html for you referencing the correct hashed bundle filename.

var HtmlWebpackPlugin = require("html-webpack-plugin");
var webpackConfig = {
    entry: "index.js",
    output: {
        path: "build/",
        filename: "index-[hash].js",
    },
    plugins: [new HtmlWebpackPlugin()]
}

This will produce `build/index.html` that includes your bundle with a `<script>` tag.

Problem

My webpack entry point includes a `[hash]` in the name: ``` entry: "index.js", output: { path: "build/", filename: "index-[hash].js", } ``` How can I link directly to that entry point from my application's HTML? For example, I'd like the HTML that's sent to the client to include: ``` <script src="build/index-41d40fe7b20ba1dce81f.js"></script> ``` How can I do this? Is there a plugin which can generate an entry point manifest which my application can read and emit the appropriate file names?

Original source