看看这个文档: https://github.com/jantimon/h...
如果不指定模板引擎,默认使用 ejs 模板解析。
However this also means that in the following example webpack will use the html loader for your template. This will cause html minification and it will also disable the ejs fallback loader.
所以你需要强制使用 html 而禁用掉 ejs。
{
module: {
loaders: [
{
test: /\.html$/,
loader: 'html-loader'
}],
},
plugins: [
new HtmlWebpackPlugin({
template: 'src/index.html'
})
]
}