how can i use webpack hash in html title?

  html, html-webpack-plugin, javascript, webpack

i am fresh for webpack, my webpack.config.js:

plugins: [
    new HtmlWebpackPlugin({
        hash: true,
        templateParameters:{title: '[name].[contenthash]' },
        inject: true,
    }), 
],

in my index.ejs:

<title><%= title %></title>

but in my out/index.html, the title is only:

<title>[name].[contenthash]</title>

expect :

 <title>app.7472b25c2ed347463dbc</title>

how can i fix it?

Source: Ask Javascript Questions

LEAVE A COMMENT