html-webpack-plugin: Title not working.
I am using 2.6.2.
The plugin is instantiated using webpack-load-plugins:
var plugins = require('webpack-load-plugins')();
var webpack = require('webpack');
module.exports = {
....
devtool: 'inline-source-map',
devServer: {
historyApiFallback: true,
hot: true,
inline: true,
progress: true,
// Display only errors to reduce the amount of output.
stats: 'errors-only',
// Parse host and port from env so this is easy to customize.
host: process.env.HOST,
port: process.env.PORT
},
plugins: [
new plugins.html({
title: "test app"
}),
new webpack.HotModuleReplacementPlugin()
]
}
I am using webpack-dev-server as my webserver.
This is the output:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<script src="lib.3660029166e2b80a54fa.js"></script><script src="app.fbee4ebb5e598dc6a9b1.js"></script></body>
</html>
Notice that the title is not replaced correctly.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 19 (4 by maintainers)
The same problem. Version of plugin is 2.28.0. I have html template and html-loader is defined in webpack config, but title is not set:
Template:
Result:
How to make it work?
@wandergis change your template ext index.html => index.ejs
@nateislate correct - write the title direct into your html file or use a template language of your choice
@F21 maybe you need this with 2.x